0

我正在使用 jQuery qTip 插件,并且无法从另一个元素将 html 内容加载到其中。

我有以下代码:

$('.tip').qtip({
    content: { 
        text: $(this).next('.product_info').html() 
    }
});

使用以下html:

<a href="#" class="tip">An Image</a>
<div class="product_info">Some content</div>

问题是我似乎无法使用“$(this)”,那么如何引用当前的“.tip”?

谢谢!

4

1 回答 1

1

i think this question's answer will answer this for you: qtip jquery plugin to display text from link

basically you need to loop through your things to tip and then tip then individually and this will work;

$('.tip').each(function(){
    $(this).qtip({
        content: { 
            text: $(this).next('.product_info').html() 
        }
     });
});
于 2010-07-20T16:22:17.067 回答