Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1448 How do I unselect the highlighted item of a drop down list?

You are here: irt.org | FAQ | JavaScript | Form | Q1448 [ previous next ]

Try:

<script language="JavaScript"><!--
document.myform.mySelect.selectedIndex=-1;
//--></script>

or:

<form name="myform">
<select name="myselect">
<option value="">---- Select something ---
<option value="1">One
....
</select>
</form>

and use:

<script language="JavaScript"><!--
document.myform.myselect.options[0].selected = true;
//--></script>

or possibly (but I have never used it):

<script language="JavaScript"><!--
document.myform.myselect.options[document.myform.myselect.selectedIndex].selected = false;
//--></script>

Feedback on 'Q1448 How do I unselect the highlighted item of a drop down list?'

©2018 Martin Webb