Get selected text from a drop-down list (select box) using jQuery

2.5k2009 年提問 · haddar ·javascriptjquerydomdrop-down-menujquery-selectors 主題:DOM、事件、表單與 jQuery → 在 Stack Overflow 看原文 ↗

How can I get the selected text (not the selected value) from a drop-down list in jQuery?

重點答案

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.