googlemap api code on dropdown and text box

Go To StackoverFlow.com

0

How to get the value that is selected in the dropdown box to a text box. I have a text box and a drop down box in which village names are listed.If the selection is changed that value should reflect on text box.Please help me.

2012-04-04 07:02
by 7783


0

This is a Javascript 101 question! I shouldn't answer but ....

<script type="text/javascript">
function selectChange(val)
{
   document.getElementById("text_id").value = val;
}
</script>
<form>
<input id="text_id" value="" type="text" size="10" />
<br />
<select id="select_id" onChange="selectChange(this.value);">
<option value="">-- Select --</option>
<option value="val1">val1</option>
<option value="val2">val2</option>
<option value="val3">val3</option>
</select>

2012-04-04 12:24
by Eric Bridger
it works well....thank you.. - 7783 2012-04-05 06:37
Ads