To change the selected option of an HTML Select element with JavaScript, we set the value
property.
For instance, we write
<select id="sel">
<option value="1">Cat</option>
<option value="2">Dog</option>
<option value="3">Fish</option>
</select>
to add a select drop down.
Then we write
document.getElementById("sel").value = "1";
to select the drop down with getElementById
.
And we set its value
property to the string of the value attribute of the option element we want to select to select it.