We help IT Professionals succeed at work.

How do I clear drop-down selection so user can make any selection from same drop-down menu?

brianhu asked
Last Modified: 2012-08-14
How do I clear drop-down selection when choice is made so user can immediately make any or same selection from same drop-down (choice made launches new browser window)?

My example URL:

I would like user to be able to easily choose any option from any of 3 drop-downs, whether same option already selected or not. Right now, selection does not clear and selection must be different to launch window with info. JavaScript for this?
Watch Question


Clarified question.
HonorGodSoftware Engineer

Locate the select element, and change the selectedIndex value to 0
<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<title> Pick and Clear </title>
<script type='text/javascript'>
  function doit( obj ) {
    if ( obj ) {
      if ( obj.nodeName == 'SELECT' ) {
        alert( 'Pick: ' + obj.options[ obj.selectedIndex ].text );
        obj.selectedIndex = 0;
      } else {
        alert( 'select object expected, but found: ' + obj.nodeName );
    } else {
      alert( 'select object required, but not specified' );
<form action=''>
  <select id='sel' onchange='doit(this)'>
  <option>Make a selection</option>

Open in new window



Sorry, I'm not following -
When I change onchange=  to  onchange="doit(this)" or onchange="doit()", I just get the default messages without sending value to php script. Please see my form tag below (without change above):

(JavaScript function is in head section as given.)

Thank you!
<form action="PHP/connectivity.php" method="get" target="_blank" class="style15">
                           <div align="center"><span class="style14"><em style="font-size:11px;">P/N: &nbsp;</em> MDI1</span>
                             <select name="mdrivepn" id="mdrivepn" onchange="this.form.submit()" style="font-size:10px; font-weight:bold; letter-spacing:.05em;">
                               <option selected="selected">Select</option>
                               <option value="MDI1FRD23*7">F RD</option>
                               <option value="MDI1FRL23*7">F RL</option>
                               <option value="MDI1FCB23*7">F CB</option>
                               <option value="MDI1PRD23*7">P RD</option>
                               <option value="MDI1PRL23*7">P RL</option>
                               <option value="MDI1PCB23*7">P CB</option>
                             <span class="style14"> 23*7</span> </div>

Open in new window

Software Engineer
This one is on us!
(Get your first solution completely free - no credit card required)


Yes, having onchange="this.form.submit(); this.selectedIndex=0" (both commands) in my form tag was all I needed. Thanks for your help!
But God demonstrates His own love toward us, in that while we were still sinners, Christ died for us.  -Romans 5:8   What a glorious God!

Brian Hurst
HonorGodSoftware Engineer

You are very welcome.  I'm glad to have been able to help.

Good luck & have a blessed day.

p.s. Thanks for sharing the verse

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.