How can i acces an select element if it has been selected?
var select = document.getElementById("select");
if(select.selected == true)
doesnt work any idea?
How can i acces an select element if it has been selected?
var select = document.getElementById("select");
if(select.selected == true)
doesnt work any idea?
document.getElementById("mySelect").value
or
var selObj = document.getElementById("mySelect"); selObj.options[selObj.selectedIndex].value;
The DOM tree is something like
Select
|-option
|-option
`-option
it is not the select node which can be selected. As such, you need to get the select, browse the childs, and test if the child is selected until you find one.