2016-09-14 8 views
0

「その他」オプションをクリックすると、追加のテキストフィールドが表示されるhtml形式のオプション/リストボックスが完成しました。私はJavaScriptを使用して追加のテキストフィールドを作成します。コードは、それが「その他」オプションが選択されたときに提出されたテキストを作成しますJavaScriptで作成された入力テキストの値を取得する

document.getElementById('div1').innerHTML='Other: <input id="othr" type="text" name="other" />'; 

以下の通りです

<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スクリプト以下の通りです。しかし、入力タグとして他のテキストフィールドの値を取得する方法は、Javaスクリプトにあります。

+0

可能な重複ボックス](http://stackoverflow.com/questions/4088467/get-the-value-i n入力テキストボックス) –

答えて

関連する問題