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.
This is what works
Or
Above codes worked well for me
To get the jquery value from drop down you just use below function just sent
id
and get the selected value:If you have more than one dropdown try:
HTML:
JavaScript:
Did you supply your select-element with an id?
Your first statement should work!