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正的輸入文本框) –