简体   繁体   English

如何通过单击jquery中的删除按钮来删除所显示的表中的行

[英]How to remove row in shown table by clicking on delete button in jquery

I have table that created by "HTML Helper" contain two columns the first column include file name and the second column include button with value "delete" , I want to remove the row by clicking on delete button , I tried to do this but it is not work this image contain on the code that used to create the table 我有由“HTML Helper”创建的表包含两列第一列包含文件名,第二列包含值为“delete”的按钮,我想通过单击删除按钮删除该行,我试图这样做但是它这个图像包含在用于创建表的代码上不起作用 在此输入图像描述 and this image contain on JQuery code 这个图像包含在JQuery代码上

在此输入图像描述

Like this: 像这样:

$('#tb2').on('click', '.rmv1', function() {
    $(this).parents('tr').remove();
});

Or as you did, but actually calling the remove function: 或者像你一样,但实际上调用了remove函数:

$('#tb2').on('click', '.rmv1', function() {
    $(this).parent().parent().remove();
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM