以下代码返回零。 ddlType
放置在表格行中。
$("#tblType").on('change', 'select.ddlType', function (event) {
alert($(this).index());
});
最佳答案
要获取表中最接近的 tr
的索引,请尝试以下操作:
$("#tblType").on('change', 'select.ddlType', function (event) {
alert($(this).closest('tr').index());
});
关于jquery - 如何在放置在表行中的下拉列表更改事件上查找行索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20422333/