I have a html form, and I need to make the input value equal whatever is chosen as a select option (due to the way the form is processed, the value must be associated with an input tag - it won't work from within a select tag).(我有一个html表单,我需要使输入值等于选择作为选择选项的任何值(由于处理表单的方式,该值必须与input标记相关联-不能在选择标签)。)
Here are the select options in my form:(这是我表单中的选择选项:)
<select type="hidden" name="item_colour" id="select">
<option value="yellow item" selected>yellow</option>
<option value="blue item">blue</option>
</select>
Is it possible to create a hidden input along these lines:(是否有可能沿着这些行创建隐藏的输入:)
<input type="hidden" name="item_name" value=item_colour>
The above obviously doesn't work, and I'm thinking I need to somehow use the following javascript:(上面的代码显然不起作用,我想我需要以某种方式使用以下javascript:)
document.getElementById("item_colour")
But I'm stumped how to make it all work.(但是我很困惑如何使其全部正常工作。) Thanks.(谢谢。)
ask by Dr_Hoon translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…