I have been searching for a way to get the id
from a drop-down list option, when it is selected. I have found the following:
Get selected text from a drop-down list (select box) using jQuery
And tried to change the accepted answer to:
$("#yourdropdownid option:selected").id;
But when I alert()
it, it gives me "undefined". Is there a way to get the id using JQuery?