How to enable bootstrap tooltip and popover (on a bootstrap based theme)? I'm using a theme based on Bootstrap 3.

I want to use Tooltip and Popover features that come with Bootstrap but I couldn't.

It's said on the Bootstrap Javascript page that:


  Opt-in functionality
  
  For performance reasons, the Tooltip and Popover data-apis are opt-in,
  meaning you must initialize them yourself.
  
  One way to initialize all tooltips on a page would be to select them
  by their data-toggle attribute:

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})





I tried to add the code above to my node.tpl.php (inside of  tags) but it didn't work. I also tried to save that code as script.js and added it to my theme info file but it didn't work.

How can I enable these features? Where to use the above code?
I could enable the tooltip and popover by adding the code below to my node--mytype.tpl.php:

&lt;script&gt;
(function($) {
$(document).ready(function() {
$('[data-toggle=tooltip]').tooltip();
});
})(jQuery);
&lt;/script&gt;



I added this JavaScript to my custom node--mytype.tpl.php because I wanted to use tooltip only on that content type.

If you want to use the tooltip anywhere on the website (eg on the blocks), you should add the code above to your theme's html.tpl.php file, just before the closing body tag.