twitter-bootstrap-tooltip

Bootstrap tooltip click trigger not working


Absolute noob here. My aim is to get the bootstrap-tooltip to appear on clicking a bootstrap-glyphicon. But it appears on hover instead. Sharing the jsfiddle here - https://jsfiddle.net/govind91/Lzzgxcro/

This is the html

<span class="glyphicon glyphicon-question-sign" aria-hidden="true" title="Some tooltip text!" data-toggle="tooltip" data-trigger="click" > </span>

Javascript

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

Kindly let me know where I'm going wrong.


Solution

  • I believe you need to include the Bootstrap JavaScript file in addition to the CSS files, and then it should work!

    https://jsfiddle.net/a4WwQ/1082/

    $('a[data-toggle="tooltip"]').tooltip({
        animated: 'fade',
        placement: 'bottom',
        trigger: 'click'
    });