html – How do you get the currently selected
html – How do you get the currently selected
This will do it for you:
var yourSelect = document.getElementById( your-select-id );
alert( yourSelect.options[ yourSelect.selectedIndex ].value )
The .selectedIndex
of the select
object has an index; you can use that to index into the .options
array.
html – How do you get the currently selected
var payeeCountry = document.getElementById( payeeCountry );
alert( payeeCountry.options[ yourSelect.selectedIndex ].value );