简体   繁体   中英

qTips JS script from JS Fiddle Doesn't Work

I am trying to implement the following qTip tooltip script on my page:

// Create the tooltips only when document ready
$(document).ready(function()
{
  // MAKE SURE YOUR SELECTOR MATCHES SOMETHING IN YOUR HTML!!!
  $('a').each(function() {
     $(this).qtip({
         content: {
             text: $(this).next('.tooltiptext')
         }
     });
 });
});

I got the script directly from the JS Fiddle documentation page , but unfortunately, the script doesn't work on JS Fiddle either. I am sure there is a typo somewhere in this, but I don't have the JS skills to find it.

Can someone help me to correct this script?

thanks

I like qTip2 but the one thing that I hate about it is that its documentation blows. The creator gives sample code but omits certain necessary parts of it which makes it confusing. He also includes broken fiddles like the one you gave above.

Not to mention, that fiddle is unnecessarily complicated if he is just displaying one tooltip.

I created a very basic example of a qTip2 at the link here: http://jsfiddle.net/ah653at2/1/

I hope you can use this instead to gain a basic understanding of the library.

HTML:

<a id="test">A very basic tooltip example</a>

JavaScript:

$("#test").qtip({
    content: {
        text: 'This is some tooltip content',
    },
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM