php - Action on selecting option from drop down menu -


i started working drop down menus. trying figure out how make happen once user chooses particular option drop down menu.

for example, have following simple drop down menu.

<select>  <option value = ''> choose manager </option>  <option value = 'saf'> sir alex ferguson </option>  <option value = 'jose'> jose mourinho </option> </select> 

followed following text box.

<input type='text' name = 'club' /> 

on choosing sir alex drop down menu, want text box called club display mufc. jose, want text box called club display real madrid.

what simplest way this? more importantly, not want reload page!

<script>    function updatetext(){       $('input[name="club"]').val($('select[name="something"] option:selected').val());    } </script>      <select name="something" onchange="updatetext()">   <option value = ''> choose manager </option>   <option value = 'saf'> sir alex ferguson </option>  <option value = 'jose'> jose mourinho </option> </select> <input type='text' name = 'club' /> 

check out fiddle: http://jsfiddle.net/fkvz7/

this should update text box.. need include jquery lib this.. replace jquery javascript.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -