How can I get the selected value of a dropdown box using jQuery?
I tried using
var value = $(\'#dropDownId\').val();
and
Try this jQuery,
$("#ddlid option:selected").text();
or this javascript,
var selID=document.getElementById("ddlid");
var text=selID.options[selID.selectedIndex].text;
If you need to access the value and not the text then try using val()
method instead of text()
.
Check out the below fiddle links.
Demo1 | Demo2