0
我已经在html表单中完成了一个选项/列表框,其中如果单击“其他”选项,它将显示一个附加文本字段。我通过javascript创建了额外的文本字段。代码如下获取通过javascript创建的输入文本的值
<select name="how" class="subtitle" id="select" onchange="showfield(this.options[this.selectedIndex].value)" style="width: 200px; height:30px;">>
<option selected="true" style="display:none;">Please select</option>
<option>School</option>
<option>Consultant</option>
<option>WhatApp</option>
<option>Brochure/Poster</option>
<option>Internet</option>
<option>Other</option>
</select></td>
Java脚本是如下
document.getElementById('div1').innerHTML='Other: <input id="othr" type="text" name="other" />';
它创建选择“其他”选项时提交的文本。但是如何获得其他文本字段的值作为输入标签在java脚本中。
的可能的复制[获取在输入文本的价值盒(http://stackoverflow.com/questions/4088467/get-the-value-i正的输入文本框) –