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 the AJAX request returns successfully. How can I manipulate the tooltip after initiation?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
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
heres a nice solution if you want to change the text without closing and reopening the tooltip.
this way, text replaced without closing tooltip (doesnt reposition, but if you are doing a one word change etc it should be fine). and when you hover off + back on tooltip, it is still updated.
**this is bootstrap 3, for 2 you probably have to change data/class names
Bootstrap 4
https://getbootstrap.com/docs/4.1/components/tooltips/#tooltipdispose
I think Mehmet Duran is almost right, but there were some problems when using multiple classes with the same tooltip and their placement. The following code also avoids js errors checking if there is any class called "tooltip_class". Hope this helps.
I couldn't get any of the answers working, here's a workaround: