I have problem removing rows from a table according to the checkbox. Below is the screen shot for what I do. It's a table for air flight details.

![alt text](https://i.stack.imgur.com/66rm5.jpg)

The maximum row can be added is 15 rows. What I want to do is to give the user access to delete which particular flight or just delete all, by selecting all checkbox and press Delete Row.

The following is the jquery that use to handle this:

```
$("input[id$='_del_flight']").click(function() {

    var n = $("#" + this.id.slice(0,1) + "_airline_table tr").length;

    $("#" + this.id.slice(0,1) + "_airline_table tr").each(function(){

        if ( $("input[type=checkbox]",this).is(':checked') ) {
            if ( n > 2 ) {
                $(this).remove();
                n--;
                //alert("Value n-- is: " + n);
            } else {
                $(this).find("input").val('');
                $(this).find("input[type=checkbox]").removeAttr("checked");
                $(this).find('option:first').attr('selected', 'selected').parent('select');
            }
         }
    });
});

```

This jquery does what I want very well. The user can select any particular flight details and delete them, or the user can delete them all. 

However, when the user decides to delete them all, the jquery I have will delete the row start from row number 2 (where shown is the figure above is Flight 1). I need to come up with another way where the row MUST be deleted from the last row, which is Flight 15, then Flight 14, Flight 13 and so on. I will keep the row number 2 (used by Flight 1) by making all inputs value empty for this row.

I did try use jquery :gt selectors, it does not work like what I want. So if someone out there can help me to delete the row from the very last row (for delete all) and keep the feature where the user can delete particular flight based on the user selection, I would really appreciate it.

Thank you so much for your help.