It is interesting that it worked on the first one at all, but you are adding an event listener to all TD elements when the document loads. However, you are creating new ones, which do not have the event listener.
I rewrote the script as follows to solve the problem:
$("body").on('click', 'td .remove', function() {
$(this).closest("tr").remove();
return false;
});
As a bonus: Using closest("tr")
is better than doing parent().parent()
. When you do the latter and you later change your design, you might get a bug.