Change Twitter Bootstrap Tooltip content on click

前端 未结 25 1367
情深已故
情深已故 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:19

    In Bootstrap 3 it is sufficient to call elt.attr('data-original-title', "Foo") as changes in the "data-original-title" attribute already trigger changes in the tooltip display.

    UPDATE: You can add .tooltip('show') to show the changes immediately, you need not to mouseout and mouseover target to see the change in the title

    elt.attr('data-original-title', "Foo").tooltip('show');
    

提交回复
热议问题