jquery qtip 插件

发布于 2024-09-10 12:03:38 字数 393 浏览 7 评论 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”?

谢谢!

I am using the jQuery qTip plugin and am having trouble loading html content into it from another element.

I have the following code:

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

with the following html:

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

The problem is that I cannot seem to use "$(this)" so how can I refer to the current ".tip"?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

粉红×色少女 2024-09-17 12:03:38

我认为这个问题的答案将为您解答:
qtip jquery插件显示链接中的文本

基本上你需要循环检查你的东西,先给小费,然后再单独给小费,这样就可以了;

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

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() 
        }
     });
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文