views:

70

answers:

3

I need to apply a tooltip plugin to a bunch of different elements on my page. The only common property to work with a jQuery selector is that they all have a title property set.

I tried $('[title=*]') as a selector but this didnt work.

+7  A: 

Simply:

$('[title]')

See also - Has Attribute Selector:

Selects elements that have the specified attribute, with any value.

Kobi
+6  A: 

Try $('*[title]'), more about attribute selectors here on the W3C page.

T.J. Crowder
+4  A: 

Also $('[title!=]') should work but catches only elements that have title set and not empty (not title="")

Keeper
Very good to know! Thanks
Jimbo