jQuery: detecting if there are no rows left in table
<p>I'm trying to detect if there are any rows left in a table, once none exist, I will display an alert.  The following code doesn't seem to work, any ideas? (There will be one row left with the table headers, which is why I used the index 1)</p>

<pre><code>$('.remove_row').live('click', function() {

    //If there are no rows left in table, display alert
    if ( $(this).parent().parent().parent().children('tr:eq(1)').length == 0) {

        alert("no rows left");

    }

    $(this).parent().parent().remove();

});
</code></pre>

<p>EDIT: I tried with the remove before the alert, and it triggers every time I remove a row.</p>

<hr>

<p>EDIT AGAIN: Got it, needed to make the index 2, since it is checking before the final one is actually removed from the DOM.</p>
