I'm using Twitter Bootstrap to create tooltips. Currently, I init the tooltips in $(document).ready()
:
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
This calls tooltip()
(which inits the listeners) for every element that has the data-toggle
element.
The problem is that if I have dynamic DOM elements (using Ajax), the tooltip()
will not be called on them. I thought of a solution like the following:
$(document).ready(function() {
$('body').on('ready', '[data-toggle="tooltip"]', function() {
$(this).tooltip();
});
});
But that doesn't work..
Any ideas..?