Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking to see if a Bootstrap tooltip is associated with a field?

I am creating Bootstrap tooltips dynamically on fields and I'd like to check to see if a given field has a tooltip so I can edit the message instead of creating a new tooltip.

I don't see anyway to do this in the Bootstrap documentation, but I imagine there a way to accomplish this. Anyone know of a way?

like image 740
James McMahon Avatar asked Apr 20 '13 22:04

James McMahon


1 Answers

Using Bootstrap 3:

var field = $('.example');

if (field.data('bs.tooltip')) {
    // tooltip is initialized
} else {
    // tooltip is not initialized
}
like image 81
BitByteDog Avatar answered Oct 28 '22 07:10

BitByteDog