Question about choosing jQuery for form shortcuts

I am trying to make a selector using form labels.

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

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

If someone selects a label for "other", do something. If they choose a shortcut for everything that is not “different,” do something else.

+3
source share
2 answers

You can do this $("label[for!='other']")to select tags that do not have an attribute forset to 'other'.

+5
source

Using:

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

or

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

Source: https://habr.com/ru/post/1727396/


All Articles