工具提示中的数据 -id 内容
Data -id content inside of tooltip
我需要从工具提示中的数据内容ID中获取内容。出于某种原因,它不会抓取内容并将其拉入其中。
这是代码:
// Create the tooltips only when document ready
$(document).ready(function()
{
/// Grab all elements with the class "hasTooltip"
$('.hasTooltip').each(function() { // Notice the .each() loop, discussed below
$(this).qtip({
content: {
text: $('#tooltip-content-' + $(this).find('[data-contentid]').data('contentid')) // Grab content using data-content-id attribite value
}
});
});
});
为了更好地理解,这里有一个小提琴:http://jsfiddle.net/L6yq3/465/可以看到的地方,我无法在工具提示中获得"CONTENTEXAMPLE"。
我认为text
接受一个函数,所以请尝试:
// Create the tooltips only when document ready
$(document).ready(function () {
/// Grab all elements with the class "hasTooltip"
$('.hasTooltip').each(function () { // Notice the .each() loop, discussed below
$(this).qtip({
content: {
text: function () {
return $(this).next('[data-contentid]').data('contentid');
}
}
});
});
});
小提琴
或者更确切地说是这样:(我不明白你的 html 结构)
小提琴
相关文章:
- 音乐播放器使用相同的id播放所有内容
- 如何使用 html 类或 id 在任何地方显示内容
- 如何在html / JS中展开或关闭内容 - 始终分配给不同的id
- 如何使用相同的id但不同的内容进行更新
- 如何将url id映射到服务器上的内容
- 通过JQuery获取动态内容的ID
- 按id联接列内容
- 获取LI数据ID's来自动态内容
- 如何在没有任何元素id的情况下检索表中的文本内容
- 指向“”的超链接;隐藏的“;jQuery Toggler内部的内容(特定的#id)
- 当 ID 相同时,如何获取数据 - * 内容
- 隐藏内容空间 ID 和访问令牌,客户端 JavaScript 文件
- jQuery 选择器,用于编程生成内容的 ID
- 如果输入字段通过 ID 或类包含内容,则禁用输入字段
- Angular 获取特定 ID 中的标签内容
- 如何根据 Div ID 内容隐藏/显示 DIV
- 工具提示中的数据 -id 内容
- URL中的溢出隐藏和ID.内容未显示,跳到顶部
- 如何重定向或iframe id内容
- 从dojo内容窗格中的html加载特定的id内容