XYZ <" /> XYZ <" /> XYZ <"/>

Get tooltip of label with specific attribute with jquery

2.9k Views Asked by At

I have many labels with tooltip value.

label class="btn btn-default" data-placement="top" data-toggle="tooltip" data-original-title="Some title">XYZ </label>

If the label is active then property looks like this.

'<label class="btn btn-default active"  data-placement="top" data-toggle="tooltip" data-original-title="Some title">XYZ </label>'

Now I want to assign the tooltip value of the active label to variable using jquery. Thanks in advance.

1

There are 1 best solutions below

0
Mayank On

Try the FIDDLE

As far as i understand you want to get the value of tooltip text from jquery on elements having class active.

var $tooltip =  $('.active').attr('title');

documented here

in case you want data attribute's value, you can use following value

var $datatitle = $('.active').data('original-title');

documented here