Javascript to select first option of select list

There is no such property as someForm.select, try this instead:

selectTags = myForm.getElementsByTagName("select");

for(var i = 0; i < selectTags.length; i++) {
  selectTags[i].selectedIndex =0;
}  

A quick note to answer from Ron Royston (I've only tried this on Chrome 74.0)

Setting mySelect.selectedIndex = 0; or $('#mySelect').prop("selectedIndex", 0); won't work if the option if it's disabled.

Hope this saves someone some time and frustration!

Tags:

Select

Reset