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
for Bootstrap 4:
Thanks this code was very helpful for me, i found it effective on my projects
$(element).attr('title', 'message').tooltip('fixTitle').tooltip('show');
Change the text by altering the text in the element directly. (does not update the tooltip position).
Change the text by destroying the old tooltip, then creating and showing a new one. (Causes the old one to fade out and the new one to fade in)
I'm using the top method to both animate the "Saving." message (using
 
so the tooltip does not change in size) and to change the text to "Done." (plus padding) when the request completes.Useful if you need to change a tooltip's text after it has been initialized with attr 'data-original-title'.
you can update the tooltip text without actually calling show/hide:
This works if the tooltip has been instantiated (possibly with javascript):