is there a way to do: if options have class 1 and 2 then add class A in jQuery?
So this :
<select class="rubrique" name="ctl00">
<option class="" value="" selected="selected"></option>
<option class="1" value="1">1</option>
<option class="2" value="2">2</option>
</select>
would give me that:
<select class="rubrique" name="ctl00">
<option class="" value="" selected="selected"></option>
<option class="1 A" value="1">1</option>
<option class="2 A" value="2">2</option>
</select>
If you want both class 1 and class 2 to be present:
You can chain the class-selector
.and class-names to find elements with both.Otherwise, as noted, if you want to add class A to both:
Is what’s needed.
With thanks @T.J. Crowder for pointing out my original mis-reading of the question example.