admin管理员组文章数量:1331849
I am trying to change the hyperlink title using javascript/jquery when the link is clicked. HTML
<a
href="javascript:addRss('234');"
class="btn btn-success"
title="Add content to Personal RSS"
id="addRssbtn"
data-toggle="tooltip" >
<i class="fa fa-rss fa-lg"></i>
</a>
CSS
@import url(".1.1/cerulean/bootstrap.min.css");
@import url(".1.1/css/bootstrap-theme.min.css");
@import url(".0.3/css/font-awesome.min.css");
JAVASCRIPT
$(function (){$('[data-toggle="tooltip"]').tooltip({});});
function addRss(hash){
$("#addRssbtn").attr("class", "btn btn-success active");
$("#addRssbtn").attr("title", "Remove content from Personal RSS");
$("#addRssbtn").attr("href", "javascript:unaddRss(" + hash + ");");
//some other post data stuff
};
the title gets changed and shows too, only if i am not using
data-toggle="tooltip"
so how can i make the data-toggle="tooltip" to show the new changed title as a tooltip when the link is clicked ?
/
above code is working except the new tooltip on my pc but not on jsfiddle.
I am trying to change the hyperlink title using javascript/jquery when the link is clicked. HTML
<a
href="javascript:addRss('234');"
class="btn btn-success"
title="Add content to Personal RSS"
id="addRssbtn"
data-toggle="tooltip" >
<i class="fa fa-rss fa-lg"></i>
</a>
CSS
@import url("http://netdna.bootstrapcdn./bootswatch/3.1.1/cerulean/bootstrap.min.css");
@import url("http://netdna.bootstrapcdn./bootstrap/3.1.1/css/bootstrap-theme.min.css");
@import url("http://netdna.bootstrapcdn./font-awesome/4.0.3/css/font-awesome.min.css");
JAVASCRIPT
$(function (){$('[data-toggle="tooltip"]').tooltip({});});
function addRss(hash){
$("#addRssbtn").attr("class", "btn btn-success active");
$("#addRssbtn").attr("title", "Remove content from Personal RSS");
$("#addRssbtn").attr("href", "javascript:unaddRss(" + hash + ");");
//some other post data stuff
};
the title gets changed and shows too, only if i am not using
data-toggle="tooltip"
so how can i make the data-toggle="tooltip" to show the new changed title as a tooltip when the link is clicked ?
http://jsfiddle/h5kKa/
above code is working except the new tooltip on my pc but not on jsfiddle.
Share Improve this question asked Apr 29, 2014 at 13:05 user1642018user16420182 Answers
Reset to default 8Update the tooltip using the fixTitle
option.
$("#addRssbtn").attr("title", "Remove content from Personal RSS")
Bees
$("#addRssbtn").attr("title", "Remove content from Personal RSS").tooltip('fixTitle');
You can add .tooltip('show');
to show the tooltip straight after:
$("#addRssbtn").attr("title", "Remove content from Personal RSS").tooltip('fixTitle').tooltip('show');
http://jsfiddle/h5kKa/2/
You weren't looking for anything like this this were you?
$("#addRssbtn").tooltip("option", "content", "title");
Here is a jfiddle for it
E: just beaten
版权声明:本文标题:Bootstrap 3 - How to change the hyperlink title text showing as tooltip using javascriptjquery? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742273789a2444807.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论