且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获取下拉列表的选定索引

更新时间:2022-11-10 19:13:17

$(select [ name ='CCards']选项:选中)应该做的诀窍

有关更多详细信息,请参阅jQuery文档: http://api.jquery.com/selected-selector/

See jQuery documentation for more detail: http://api.jquery.com/selected-selector/

更新:
如果您需要所选选项的索引,则需要使用 .index() jquery方法:

UPDATE: if you need the index of the selected option, you need to use the .index() jquery method:

$("select[name='CCards'] option:selected").index()