Question: how to set selected value of dropdown in javascript using index?
Answer: Select the <option> element with index "2": getElementById("mySelect"). selectedIndex = "2";
Deselect all options: getElementById("mySelect"). selectedIndex = "-1";
The selectedIndex property will return "-1" if no options are selected: getElementById("mySelect"). selectedIndex;