我从自定义标签 data-tooltip 加载工具提示文本。如果数据工具提示不存在,我希望隐藏工具提示。这可能吗?
示例 jsfiddle
最佳答案
试试这个:
$(document).ready(function() {
$('#menu a').qtip({
content: {
attr: "data-tooltip"
}
});
});
qtip2 文档说明了使用“text”而不是“attr”:
Custom functions that return no valid content will still cause the tooltip to be created! Replace these with an each() loop if this is not the desired behaviour.
如果你看看“attr”的使用,它会说:
If no valid content is found within the elements attribute, and content.text is not defined, no tooltip will be rendered.
关于javascript - qTip2 如果内容为空则隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10981951/