Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery selector if has a title

Using jquery, I want to select input[type="text"] elements which has a title attribute(not a specific content, just the existance of the title).

How can I achieve that ?

like image 427
Hellnar Avatar asked Dec 21 '25 05:12

Hellnar


2 Answers

You can specify multiple attributes, as in the following selector:

$('input[type="text"][title]')

Working example here: http://jsfiddle.net/VW64y/

like image 159
wsanville Avatar answered Dec 22 '25 18:12

wsanville


An attribute selector without the equals clause will just test for existence:

$("input[type='text'][title]");
like image 42
Dennis Avatar answered Dec 22 '25 19:12

Dennis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!