jquery delete table row on click on check box

3.2k Views Asked by At

I have a table which is dynamically created , there is a checkbox in each row of the table, when user click that checkbox the whole row of the dynamically created table needs to deleted.

5

There are 5 best solutions below

0
hunter On BEST ANSWER
$("tr input:checkbox").live("click", function(){ 
    $(this).closest("tr").remove(); 
});
3
Josiah Ruddell On
$('table.grid input:checkbox').change(function(){
    $(this).parents('tr').remove();
});
0
Russ Cam On
$('table').delegate('tr input:checkbox', 'click', function () {
    $(this).closest('tr').remove();
});

Demo here

0
brettkelly On
$(function(){
    $(".yourCheckboxClass").change(event){
        function(){
            $(this).closest('tr').remove();
        }
    }
});
0
Sumith Harshan On

You can apply this specific table, like this.

$("#yourtableID  tr").live("click", function(){ 
    $(this).closest("tr").remove(); 
});