This page implements the code found at https://www.dyn-web.com/tutorials/forms/select/selected.php
Please note that you would want to put the code in the onclick event handlers into functions.
See the webpage above if you need help on that.


Choose an option and then click on the button below the list
The onclick event handler will define a var ddL which is this dropdown list
and then alert ddL.value




Choose an option and then click on the button below the list
The onclick event handler will define a var ddL which is this dropdown list
and then define opt = ddL.options[ddL.selectedIndex]
That is, opt is the specific option selected. The event handler then alerts opt.value.





Choose an option and then click on the button below the list
The onclick event handler will define a var ddL which is this dropdown list
and then loop thru the options list to find which one has selected to be true.
That is, opt is the specific option selected. The event handler then alerts opt.value.