Checking to see if a Bootstrap tooltip is associated with a field?
Method I ended up using just in case it is useful to anyone else,
var field = $('.example');
if (field.data && field.data('tooltip')) {
// tooltip not initalized
} else {
// it is
}
I also don't see any documentation related. But you can check with a jQuery if the tooltip has the attribute data-original-title. This attribute is added by the plugin while initializing the element and is used for the tooltip text content.
if ($('.example').attr('data-original-title')) {
console.log('Tooltip not initialized');
} else {
console.log('Tooltip initialized');
// Change the tooltip content
$('.example').attr('data-original-title', 'My new title');
}
Using Bootstrap 3:
var field = $('.example');
if (field.data('bs.tooltip')) {
// tooltip is initialized
} else {
// tooltip is not initialized
}