[jQuery] jquery adding and removing row

[jQuery] jquery adding and removing row


Hello,
I want to be able to add row at the end of the table with a 'remove'
link which will remove specific row.
The code I've managed to write so far:
    $(document).ready(function() {
    $("#add_item").click(function () {
            var html = "<tr id='item_" + item_id + "' class='item'><td><a
href='#' class='remove' id='remove_" + item_id + "'>remove</a></td></
tr>";
            var o = $("#calc .item :last");
            var newo = o.parent().after(html);
            newo.find('.remove').click(function () {
                newo.remove();
                alert('hel');
            });
            item_id++;
            return false;
    });
    });
should work with the following html structure:
<table id="calc">
    <tr class="item">
        <td>test</td>
    </tr>
    <tr class="item">
        <td>test</td>
    </tr>
</table>
The problem is it wont instert the row at the proper place (after the
last .item (class) and the remove link wont work for the last row in
the table/list.
I have no idea why no handler is put on the last row.
Any help is highly appreciated!