I use the following to add a table row:
- $(".add-row").live('click', function(){
- var newRow = $('#mytable tr:last').clone().insertAfter('#mytable tr:last');
- $('#mytable tr:last td:first img').css("visibility", "visible");
- $('#mytable tr:last td :input').val('');
- });
and the following to delete a row:
- $("img.delrow").click(function(){
- $(this).parents("tr").remove();
- return false;
- });
The delrow class is in the first td cell on every row:
- <td><img src="del.png" alt="" class="delrow" style="visibility: hidden;" /></td>
I tried different selectors in the delrow function as well, and when I click to add a row I see the "X" image, but clicking it does not delete the row. Firebug does not show any error. Does anyone know why this is? Thanks.