Bootstrap tooltip click trigger not working

Govind picture Govind · Feb 9, 2016 · Viewed 15.4k times · Source

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.

Answer

Myles O&#39;Connor picture Myles O'Connor · Feb 10, 2016

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'
});