$('table#Items').on('click','tr input#delItem',function(e){
$(this).closest('tr').remove();
});
大家好。请告诉我,删除两个表行代替一个表的正确解决方案是什么?谢谢
答案 0 :(得分:4)
以下代码将从最近的行中删除下一行和上一行。
尝试,
$('table#Items').on('click','tr input#delItem',function(e){
var closestRow = $(this).closest('tr');
closestRow.add(closestRow.prev()).add(closestRow.next()).remove();
});
答案 1 :(得分:3)
以下是一个示例:http://jqversion.com/#!/72F15CA/1
$('table#Items').on('click','tr input#delItem', function(e){
$(this).closest('tr').nextAll().slice(0,2).remove();
});