Something to bear in mind that confuses some people, is that the select options have two parts. One of those parts is the value, as selected in the value=”” section, and the other is the text value that is displayed on the users browser.
Here’s how to get either the hidden value, or the text value with either method:
var e = document.getElementById("elementId"); var value = e.options[e.selectedIndex].value; var text = e.options[e.selectedIndex].text;
$("#elementId :selected").text(); $("#elementId").val();
The element ID refers to the id of the selector, for example:
<select name="someName" id="elementID"> <option value="[VALUE]">[TEXT]</option> </select>