If i have the following HTML code for a standard drop-down box:
Notice how the second option value is "selected".
Does anyone know if there is a way, in Javascript, that will automatically change the "selected" option to whatever option that the user selected after the form is submitted?
The purpose is to always display the current, selected option, on the webpage, within the drop-down box.
Thanks for your help.
Code:
<form name= "test" action="/default.asp" method="GET">
<select name="location">
<option value="abilene">Abilene, TX</option>
<option selected value="akron-canton">Akron / Canton</option>
<option value="albany-capital-region">Albany / Capital Region</option>
<option value="albuquerque">Albuquerque</option>
<option value="allentown-reading">Allentown / Reading</option>
<option value="amarillo">Amarillo</option>
<option value="anchorage">Anchorage</option>
<option value="ann-arbor">Ann Arbor</option>
<option value="asheville">Asheville</option>
<option value="athens-ga">Atlanta</option>
<option value="augusta">Augusta</option>
<option value="austin">Austin</option>
<option value="bakersfield">Bakersfield</option>
</select>
<input type="submit" value="Submit">
</form>
Notice how the second option value is "selected".
Does anyone know if there is a way, in Javascript, that will automatically change the "selected" option to whatever option that the user selected after the form is submitted?
The purpose is to always display the current, selected option, on the webpage, within the drop-down box.
Thanks for your help.