KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a dropdown menu and I cannot figure out how to make a javascript function select a drop down menu option. I have tested the output of the variables and they are all correct, but it still will not select the option when clicked. Here is the function and drop down menu. Function function formFill(a, b, c){ theform.from.value = a; theform.to.value = b; for(var i = 0;i < document.getElementById("stateSelect").length;i++){ if(document.getElementById("stateSelect").options[i].value == c ){ document.getElementById("stateSelect").selected = true; } } } Menu item <select id="stateSelect" name="stateSelect"> <option value="none">(None)</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option>
Tags (comma-separated)
Save Edits
Cancel