I have a drop down menu like below:
<select onChange="window.open(this.value)">
<option selected="selected" value="">--select an url--</option>
<option value="URL1">URL1</option>
<option value="URL2">URL2</option>
<option value="URL3">URL3</option>
</select>
I would like to have the dropdown menu return to "--select an url--" option, instead of URL option, everytime after a selection was made.
Can someone show me how to implement the codes? Thanks.
Just add this to the onChange
event:
this.value = '';
So the code would look like:
<select onChange="window.open(this.value);this.value = '';">
<option selected="selected" value="">--select an url--</option>
<option value="URL1">URL1</option>
<option value="URL2">URL2</option>
<option value="URL3">URL3</option>
</select>
This is assuming the '--select an url--' has an empty option value i.e. value=""