-2

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.

hari
  • 31
  • 3
  • 10
  • 1
    Sorry, can you be a bit clear? – Praveen Kumar Purushothaman Dec 21 '15 at 09:21
  • @PraveenKumar please check the question now, I've edited. – hari Dec 21 '15 at 09:22
  • @hari Why don't you add a FIDDLE. – Mayank Dec 21 '15 at 09:24
  • You want something in jQuery, but you haven't provided any jQuery code. Please show us what you've done in jQuery so far to accomplish this task. – Sam Dec 21 '15 at 09:47
  • @Sam , I haven't done anything so far. I'ma newbie , waiting for some solution, that I can merge into code – hari Dec 21 '15 at 10:36
  • My suggestion is that you learn jQuery if you want jQuery solutions in your code. Read the documentation here: http://api.jquery.com/ ... If we just give you code, it won't do you any good. Give a person a fish, they'll eat for a day. Teach a person to fish, they'll eat for a lifetime. – Sam Dec 21 '15 at 10:39
  • @Sam Thanks buddy for a great advice. Will work on this. – hari Dec 22 '15 at 10:47

1 Answers1

0

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

Mayank
  • 1,351
  • 5
  • 23
  • 42