开发者

Jquery selector question for form labels

开发者 https://www.devze.com 2022-12-15 07:43 出处:网络
I\'m trying to make a selector using form labels. $(\"label:not[for=\'other\']\") $(\"label[for=\'other\']\")

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 somethin开发者_StackOverflowg. If they pick a label for anything that isn't 'other' do something else.


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


Use:

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

or:

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

精彩评论

暂无评论...
验证码 换一张
取 消