jQuery Simpletip插件使用title属性
当您将SimpleTip插件应用于一组元素时,如何使用工具提示文本的每个元素的title
属性?
$('td[title]').simpletip({ content : <> });
我认为这对你有用
$('td[title]').each(function() { $(this).simpletip({ content : $(this).attr('title') }); });
$('td[title]').each(function() { $(this).simpletip({ content : $(this).attr('title') }); });
我找到了一个hack来做到这一点:
在Simpletip源代码中,第25行:
// change this line: .html(conf.content) // to this .html(conf.content ? conf.content : elem.attr('title'))
然后当你调用simpletip函数时:
$('td[title]').simpletip({ content: false });
是的,它有点hacky,但它的工作原理。