Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn the Tooltip Bootstrap functionality off

According the documentation is is possible to turn off the functionality just doing $('body').off('.alert.data-api').
In the case of tooltip I tried the following from js console $('body').off('.tooltip.data-api') but it does not disable the tooltip on bottons.
Any hints how to precede?

like image 947
Lorraine Bernard Avatar asked Nov 16 '12 10:11

Lorraine Bernard


People also ask

How do I enable tooltip disabled?

By default, tooltips will not be displayed on disabled elements. However, you can enable this behavior by using the following steps: Add a disabled element like the button element into a div whose display style is set to inline-block . Set the pointer event as none for the disabled element (button) through CSS.

How do I enable Bootstrap tooltip?

To create a tooltip, add the data-toggle="tooltip" attribute to an element. Note: Tooltips must be initialized with jQuery: select the specified element and call the tooltip() method.


1 Answers

You can't disable tooltips that way because it has no event listener on the body. Instead, you can disable the tooltips themselves using the code below.

$('[rel=tooltip]').tooltip()          // Init tooltips $('[rel=tooltip]').tooltip('disable') // Disable tooltips $('[rel=tooltip]').tooltip('enable')  // (Re-)enable tooltips $('[rel=tooltip]').tooltip('destroy') // Hide and destroy tooltips 

Edit: For Bootstrap 4, the 'destroy' command has been replaced by the 'dispose' command, so:

$('[rel=tooltip]').tooltip('dispose') // Hide and destroy tooltips in Bootstrap 4  
like image 154
Arnold Daniels Avatar answered Sep 22 '22 16:09

Arnold Daniels