down list (select box) using jQuery

我如何从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.

链接地址: http://www.djcxy.com/p/764.html

上一篇: 如何将项目插入到特定索引处的数组中?

下一篇: 下拉列表(选择框)使用jQuery