How do you get the currently selected <option> of a <select> element via JavaScript?
<option>
<select>
This will do it for you:
var yourSelect = document.getElementById( "your-select-id" ); alert( yourSelect.options[ yourSelect.selectedIndex ].value )
2.1m questions
2.1m answers
60 comments
57.0k users