So I have a multiple checkboxes and dropdown options. When I select a checkbox, I want to apply some class to the select options of dropdown and when I uncheck the same I want to remove that applied class.
The problem, I am getting is since checkbox is multi-select, It doesn't work the way I want.
Say when I check 1st checkbox, I want to apply abc class to option audi and when I uncheck the checkbox remove that abc css class property.
Now when say both the check boxes are selected we should be able to do adding and removing of class at the same time.
<form action="">
<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car
</form>
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
Here is my fiddle
Please help.
Aucun commentaire:
Enregistrer un commentaire