Change Twitter Bootstrap Tooltip content on click

前端 未结 25 1043
情深已故
情深已故 2020-11-27 10:02

I have a tooltip on an anchor element, that sends an AJAX request on click. This element has a tooltip (from Twitter Bootstrap). I want the tooltip content to change when th

25条回答
  •  有刺的猬
    2020-11-27 10:20

    you can use this code to hide the tool tip change its title and show the tooltip again, when the ajax request returns successfully.

    $(element).tooltip('hide');
    $(element).attr('title','this is new title');
    $(element).tooltip('fixTitle');
    setTimeout(function() {  $(element).tooltip('show');}, 500);
    

提交回复
热议问题