select option javascript -- code example
Example 1: javascript get all select options
var options = document.getElementById('mySelectID').options;
for (let i = 0; i < options.length; i++) {
console.log(options[i].value);//log the value
}
Example 2: make select option selected javascript
document.getElementById('personlist').getElementsByTagName('option')[11].selected = 'selected'