简体   繁体   中英

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 在此输入图像描述 and this image contain on JQuery code

在此输入图像描述

Like this:

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

Or as you did, but actually calling the remove function:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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