Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
下午好!我有一个表,其中包含通过 AJAX 调用添加的行。这些表格有一个复选框按钮。我想在单击按钮时调用另一个 AJAX 函数,并将TD与所选复选框在同一行中的第一个值传递给函数。我知道如何做大部分事情,但我不知道是否有办法获取选定复选框所在行的 jQuery 对象?另外,为什么我不能像这样使用“this”?
TD
$("input:checked").each(function(){ var parentRow = $(this).parent();
谢谢!
利用.closest()
.closest()
$("input:checked").each(function(){ var parentRow = $(this).closest('tr');
或仅选择器:
$("tr:contains(input:checked)")