【发布时间】:2016-05-04 10:03:29
【问题描述】:
实际上,我想做这个: 我的表单中有 2 个带有一些选项的选择字段,我想要:如果首先我选择一个选项(例如 id="2"),第二个选择字段更改自动注意第一个字段选择的选项。
<form>
<select>
<option id="1"></option>
<option id="2"></option>
<option id="3"></option>
</select>
#in here if select option with 1 id show select field with 1th id:
<select id="1th">
#options here...
</select>
#if select option with 2 id show select field with 2th id:
<select id="2th">
#options here...
</select>
#if select option with 3 id show select field with 3th id:
<select id="3th">
#options here...
</select>
</form>
(通过更改表单选择字段来更改表单其他字段)。
如果你可以用 jquery 做到这一点。它甚至会更好。 谢谢。
【问题讨论】:
-
这称为连接选择。
-
不要使用以数字开头的
id。 -
请写出到目前为止你尝试过的内容。
标签: javascript jquery forms if-statement select