I have a HTML table like this:
DE 11条回答 醉梦人生 (楼主) 2020-12-13 08:11 jQuery: $('.delete').click(function() { var colNumber = $(this).parents().find('td').attr('col'); $('td[col='+colNumber+']').remove(); return false; }); HTML: DELETE COLCOL 1 DELETE COLCOL 2 DELETE COLCOL 3 DELETE COLCOL 4 DELETE COLCOL 5 DELETE COLCOL 6 ROW 1 ROW 1 ROW 1 ROW 1 ROW 1 ROW 1 ROW 2 ROW 2 ROW 2 ROW 2 ROW 2 ROW 2 0 讨论(0) 查看其它11个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
jQuery:
$('.delete').click(function() { var colNumber = $(this).parents().find('td').attr('col'); $('td[col='+colNumber+']').remove(); return false; });
HTML:
DELETE COLCOL 1 DELETE COLCOL 2 DELETE COLCOL 3 DELETE COLCOL 4 DELETE COLCOL 5 DELETE COLCOL 6 ROW 1 ROW 1 ROW 1 ROW 1 ROW 1 ROW 1 ROW 2 ROW 2 ROW 2 ROW 2 ROW 2 ROW 2