views:

331

answers:

2

I'm trying to make a selector using form labels.

$("label:not[for='other']")
$("label[for='other']")

<label for="other">
<label for="somethingElse">

If someone selects the label for 'other', do something. If they pick a label for anything that isn't 'other' do something else.

+3  A: 

You can do $( "label[for!='other']" ) to select the labels that do not have the for attribute set to 'other'.

Jacob Relkin
A: 

Use:

$("label:not([for='other'])")

or:

$("label[for!='other']")
Tatu Ulmanen