草庐IT

dropDownMenuKategorie

全部标签

jquery - 使用 jQuery 获取所选选项的索引

我对如何从HTML获取选定选项的索引有点困惑。项目。开启this页面中有两种方法介绍。但是,两者总是返回-1.这是我的jQuery代码:$(document).ready(function(){$("#dropDownMenuKategorie").change(function(){alert($("#dropDownMenuKategorieoption:selected").index());alert($("select[name='dropDownMenuKategorie']option:selected").index());});});在html中(...)Gastro

jquery - 使用 jQuery 获取所选选项的索引

我对如何从HTML获取选定选项的索引有点困惑。项目。开启this页面中有两种方法介绍。但是,两者总是返回-1.这是我的jQuery代码:$(document).ready(function(){$("#dropDownMenuKategorie").change(function(){alert($("#dropDownMenuKategorieoption:selected").index());alert($("select[name='dropDownMenuKategorie']option:selected").index());});});在html中(...)Gastro