Lucie kulza
Lucie kulza

Reputation: 1377

DOM Selectors in Javascript

If I have a form with 5 input[type='text'] in which only one has the attribute class="dontSelectMe", how do I to select all these inputs without selecting class="dontSelectMe"?

Upvotes: 0

Views: 51

Answers (2)

Abraham Hamidi
Abraham Hamidi

Reputation: 13809

Iterate through all the input[type='text']'s and check that their className isn't dontSelectMe, or use :not

Upvotes: 2

Fauxsaurus
Fauxsaurus

Reputation: 520

Pseudo Selectors:

input[type='text']:not(.dontSelectMe)

Upvotes: 2

Related Questions