We help IT Professionals succeed at work.
Get Started

Select Display Text Question

erzoolander asked
Last Modified: 2012-08-13
Hi -

We have a form with several SELECT form items within it.  We also have a javascript function that changes the selected index based upon certain criteria...   For example...

document.getElementById("state").selectedIndex = 0;
document.getElementById("region").selectedIndex = 0;

Now - the function works...as in it sets the selected index to 0 - but the option value does not update.  So - Say for State I choose...  "California" with a value of 5.  When I reset the value to 0 - it still shows "California" (which it shouldn't) - but the index HAS been changed to 0.

Is there something additional I'm missing - like selectedIndex.text or something?  or... document.getElementById("state").text?

Watch Question
Top Expert 2013
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
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
Ask ANY Question

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

  • Troubleshooting
  • Research
  • Professional Opinions
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