无法更改引导工具提示标题 [英] Can't change bootstrap Tooltip title
问题描述
我已经看过几篇关于堆栈溢出的文章,询问的问题几乎完全相同,但我发现这些问题都没有帮助.我对JQuery和Bootstrap还是很陌生,所以也许我只是错过了一些非常简单的东西.
I've already looked over several posts on stack overflow asking virtually the exact same question yet none of what I found on those questions has helped. I'm very new to JQuery and Bootstrap so maybe I'm just missing some really simple thing.
我希望能够在第一次初始化后(最好是在初始化之后多次)更改不同元素上的工具提示的标题.
I want to be able to to change the title of the tooltip on different elements after the first initialization(ideally multiple times after initialization.) A simplified version of what I'm dealing with:
<canvas id="bag0" data-toggle="tooltip" title="test">
</canvas>
...
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
$(document).ready(function(){
$('#bag0').data('tooltip',false)
.tooltip({ title: 'new text'});
$('[data-toggle="tooltip"]').tooltip();
});
此发布标题的方法已更改:如何覆盖twitter bootstrap工具提示?
This method to change the title was given from posting: How to overwrite twitter bootstrap tooltip?
工具提示始终显示为测试".我已经修改了其他一些东西,但无济于事.我怀疑我正在忽略一些明显的问题.
The tooltip always reads "test." I've tinkered with a few others things to no avail. I suspect I'm overlooking something obvious.
推荐答案
这可能有帮助
$('[data-toggle="tooltip"]').attr("title","NEW TEXT");
如果要特定元素,请说<div>
If you want to for a particular element, say a <div>
$('div[data-toggle="tooltip"]').attr("title","NEW TEXT");
这篇关于无法更改引导工具提示标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!