问题描述
我不确定100%完全可行,因为input
没有rel
属性(Bootstrap网站上的示例仅显示了一个带有rel="tooltip"
的示例),但我认为应该可以.
I'm not 100% sure this is at all possible, because input
doesn't have a rel
attribute (the example on the Bootstrap website shows only 1 example with rel="tooltip"
), but I think it should work.
这是我的HTML:
<input id="password" type="password" />
这就是我尝试触发它的方式:
And this is how I try to trigger it:
$(document).ready(function () {
$('input[id=password]').tooltip({'trigger':'focus'});
});
我也尝试过这个:
$('#password').tooltip({'trigger':'focus'});
它们似乎都不起作用.我最终想手动触发它,但这是第一步.有人知道解决方案吗?有可能吗?谢谢.
And none of them seem to work. I eventually want to trigger it manually, but this is the first step. Does anybody know a solution for this? Is it possible at all? Thanks.
推荐答案
尝试为工具提示指定"title"参数.喜欢:
Try to specify "title" parameter to tooltip. Like:
$('#password').tooltip({'trigger':'focus', 'title': 'Password tooltip'});
顺便说一句,具有"rel"属性的输入元素没什么问题.
Btw, that's nothing wrong with input element having "rel" attribute.
这篇关于如何在输入元素上使用Bootstrap工具提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!