Given this html:
<select id="fruits" name="fruits">
<option selected>Please select a fruit</option>
<option>Apple</option>
<option>Mango</option>
<option>Banana</option>
</select>
<select id="options" name="options">
<option selected>--Select a fruit first--</option>
<option>is sometimes green</option>
<option>is sometimes yellow</option>
<option>is sometimes blood red</option>
<option>is sometimes sour</option>
<option>is sometimes sweet</option>
<option>is sometimes bitter</option>
</select>
If i select apple from the first drop down, only the options
- "is sometimes green",
- "is sometimes blood red",
- "is sometimes sour"
should be available. Others should be removed/hidden. I am looking for a JAVASCRIPT ONLY solution; i don't know jQuery!
Please help!
See Question&Answers more detail:os