Noono
Noono

Reputation: 251

How to set title property for span tag dynamically

I am not able to set the title property for span tag... I am using the following code

 $('.className').find("span").attr("title",'Some_text');

Its not working...

Upvotes: 6

Views: 21638

Answers (1)

Eduardo Quintana
Eduardo Quintana

Reputation: 2388

Maybe the problem is that you are searching for a span element in a class, this will work for you.

$('span.className').attr('title','New Title');​

Here you apply the title to all the span elements with that class.

Hope it helps you.

Fiddle

Upvotes: 29

Related Questions