For dropdown options you probably want something like this:
var conceptName = $('#aioConceptName').find(":selected").text();
The reason val()
doesn't do the trick is because clicking an option doesn't change the value of the dropdown--it just adds the :selected
property to the selected option which is a child of the dropdown.
.val()
should work in your case-- you must have an error elsewhere. – Elliot Bonneville May 18 '12 at 20:17val()
why not usevar conceptVal = $("#aioConceptName option").filter(":selected").val();
? – Tester Aug 6 '13 at 21:19var conceptVal = $("#aioConceptName option:selected").val()
? – techouseNov 22 '13 at 11:53var mySelect = $('#mySelect');
/* ... more code happens ... */var selectedText = mySelect.find(':selected').text();
– Charles Wood Jul 10 '14 at 21:34