1

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.

1
  • 1
    Can give a more accurate answer if you include a snippet of the HTML for the table/checkbox. Commented Jan 4, 2011 at 19:56

5 Answers 5

7
$("tr input:checkbox").live("click", function(){ 
    $(this).closest("tr").remove(); 
});
Sign up to request clarification or add additional context in comments.

Comments

1
$(function(){
    $(".yourCheckboxClass").change(event){
        function(){
            $(this).closest('tr').remove();
        }
    }
});

Comments

1
$('table').delegate('tr input:checkbox', 'click', function () {
    $(this).closest('tr').remove();
});

Demo here

Comments

1

You can apply this specific table, like this.

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

Comments

0
$('table.grid input:checkbox').change(function(){
    $(this).parents('tr').remove();
});

3 Comments

is the ":checked" filter necessary? I guess it depends if things are checked by default. Pinu's UI should be very aggravating...
do we need to give the id of the table?
I added a class selector to the table. Probably want this for all grids. @hunter - i think i had the logic reversed. But yes depending on the default state it may not be necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.