Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery selector question for form labels

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.

like image 590
Spencer Carnage Avatar asked Feb 02 '26 10:02

Spencer Carnage


1 Answers

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

like image 90
Jacob Relkin Avatar answered Feb 04 '26 00:02

Jacob Relkin



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!