开发者

No method 'sparkline'

开发者 https://www.devze.com 2023-01-14 09:58 出处:网络
I\'ve got the following code (based on this page): <script language=\"javascript\" type=\"text/javascript\" src=\"/js/jquery.js\"></script>

I've got the following code (based on this page):

<script language="javascript" type="text/javascript" src="/js/jquery.js"></script> 
<script language="javascript" type="text/javascript" src="/js/jquery.sparkline.js"></script> 

<s开发者_开发知识库cript type="text/javascript"> 
$(function() {
    alert($('.test').html());
    $('.test').sparkline();
});
</script>

EDIT: Here's the relevant HTML:

<span class="test">1,2,3</span>

I get the alert, which shows 1,2,3, but the error console (in Chrome) says Uncaught TypeError: Object #<an Object> has no method 'sparkline'. Have I overlooked something?


Check 2 things

  1. That jquery.sparkline.js is actually present in your /js/ folder.
  2. That you're not including jQuery again further down the page, which would effectively remove any plugins you included before it (since it redefines $/jQuery).
0

精彩评论

暂无评论...
验证码 换一张
取 消