【发布时间】:2014-05-04 08:06:59
【问题描述】:
鉴于此 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>
如果我从第一个下拉菜单中选择苹果,只有选项
- “有时是绿色的”,
- “有时是血红色”,
- “有时很酸”
应该可用。其他人应该被删除/隐藏。 我正在寻找一个仅限 JAVASCRIPT 的解决方案;我不知道 jQuery!
请帮忙!
【问题讨论】:
-
@threeFourOneSixOneThree 那他为什么说他不懂jQuery?
-
@threeFourOneSixOneThree:没错!我正在寻找仅 JavaScript 的解决方案!
标签: javascript html options