In general, the essence of the problem so I have a list

<select> <option> Option 1 </ option> <option> Option 2 </ option> </ select>

and there is a field

<input type = "text" value = "50 $" disabled />

The problem in general is that the amount in the text field changes from selecting a value from the list.

Who will offer? =)

  • So the problem is that "the value in the text field changes from the selection in the list" or that "the value in the text field should change when the list is selected"? - Photon
  • It is necessary to select the item from the list, change the data in the text field Option 1 = $ 20 Option 2 = $ 30 Option 100500 = $ 1 In my head I ’m not getting any ideas) - Quiss

1 answer 1

<select id="myselect"> <option value="1">Вариант 1</option> <option value="2">Вариант 2</option> </select> <input type="text" value="50$" id="mytext" disabled /> //Для jquery сами разберетесь function $(id){ return document.getElementById(id); } $('myselect').onchange = function(){ switch($('myselect').value){ case '1': $('mytext').value=20; break; case '2': $('mytext').value=30; break; case '3': $('mytext').value=100500; break; } }