How can I get the selected value of a dropdown box using jQuery?
I tried using
var value = $('#dropDownId').val();
and
var value = $('select#dropDownId option:selected').val();
but both return an empty string.
How can I get the selected value of a dropdown box using jQuery?
I tried using
var value = $('#dropDownId').val();
and
var value = $('select#dropDownId option:selected').val();
but both return an empty string.
try this
You can use any of these:
This will alert the selected value. JQuery Code...
HTML Code...
Should work fine, see this example:
this should work for you
For single select dom elements, to get the currently selected value:
To get the currently selected text: