找不到创建的功能

时间:2010-05-05 11:13:06

标签: javascript jquery function

我正在尝试创建一个简单的函数,但在运行时,firebug说该函数不存在。

这是功能代码:

<script type="text/javascript">
function load_qtip(apply_qtip_to) {
   $(apply_qtip_to).each(function(){
      $(this).qtip(
      {
         content: {
            // Set the text to an image HTML string with the correct src URL to the loading image you want to use
            text: '<img class="throbber" src="/projects/qtip/images/throbber.gif" alt="Loading..." />',
            url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load
            title: {
               text: 'Nieuwsbladshop.be - ' + $(this).attr('tooltip'), // Give the tooltip a title using each elements text
               //button: 'Sluiten' // Show a close link in the title
            }
         },
         position: {
            corner: {
               target: 'bottomMiddle', // Position the tooltip above the link
               tooltip: 'topMiddle'
            },
            adjust: {
               screen: true // Keep the tooltip on-screen at all times
            }
         },
         show: { 
            when: 'mouseover', 
            solo: true // Only show one tooltip at a time
         },
         hide: 'mouseout',
         style: {
            tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
            border: {
               width: 0,
               radius: 4
            },
            name: 'light', // Use the default light style
            width: 250 // Set the tooltip width
         }
      })
    }
}
</script>

我试着在这里打电话:

<script type="text/javascript">
// Create the tooltips only on document load
$(document).ready(function() 
{
    load_qtip('#shopcarousel a[rel]');
   // Use the each() method to gain access to each elements attributes
});
</script>

我做错了什么?

1 个答案:

答案 0 :(得分:2)

您错过了),关闭了each来电。

将函数声明中的最后一行更改为

);}

对于将来出现的类似问题,请尝试将代码粘贴到http://www.jslint.com/