Get selected text from a drop-down list (select box) using jQuery
How can I get the selected text (not the selected value) from a drop-down list in jQuery?
How can I get the selected text (not the selected value) from a drop-down list in jQuery?
先自己寫寫看怎麼答,再往下對照重點答案。只存在你這台瀏覽器。
$("#yourdropdownid option:selected").text();
Try this:
$("#myselect :selected").text();
For an ASP.NET dropdown you can use the following selector:
$("[id*='MyDropDownId'] :selected")
The answers posted here, for example,
$('#yourdropdownid option:selected').text();
didn't work for me, but this did:
$('#yourdropdownid').find('option:selected').text();
It is possibly an older version of jQuery.