I have a problem with bootstrap\'s tooltip : When I click on a button, tooltip stays even if is the cursor is outside of the button. I have looked into the manual - Bootstra
Working Solution
$(document).on("click",function()
{
setTimeout(function()
{
$('[data-toggle="tooltip"]').tooltip('hide');
},500); // Hides tooltip in 500 milliseconds
});
If someone want's to setup a tooltip which will show for some time after click, here is how I did:
$('[data-toggle="tooltip"]').tooltip({
trigger : 'click'})
$('[data-toggle="tooltip"]').on('shown.bs.tooltip', function () {
$(this).tooltip('hide')
})
You can also use below method to hide tooltip on mouseleave, As below:
jQuery("body").on("mouseleave", ".has-tooltip", function(){
jQuery(this).blur();
});
This solution worked for me.
$('a[data-toggle="tooltip"]').tooltip({
animated: 'fade',
placement: 'bottom',
trigger: 'click'
});
$('a[data-toggle="tooltip"]').click(function(event){
event.stopPropagation();
});
$('body').click(function(){
$('a[data-toggle="tooltip"]').tooltip('hide');
});
fiddle
I tried most of the solutions given in previous answers, but none of them worked for me.
In my case for this was the fix:
beforeDestroyingElement() {
$('[data-toggle="tooltip"]').tooltip('hide');
}
I wasn't obeying this rule from Bootstrap docs:
Tooltips must be hidden before their corresponding elements have been removed from the DOM.
Hi i have little solution for this issue. When other solutions doesn't work just try this one:
$('body').tooltip({
selector: '[data-toggle="tooltip"], [title]:not([data-toggle="popover"])',
trigger: 'hover',
container: 'body'
}).on('click mousedown mouseup', '[data-toggle="tooltip"], [title]:not([data-toggle="popover"])', function () {
$('[data-toggle="tooltip"], [title]:not([data-toggle="popover"])').tooltip('destroy');
});
This is solution for drag and drop too. So i hope this help someone :)