You are generating duplicate id attributes for your button which is invalid html and the script will only be called once because you then delete the button. Instead remove the id and use a class name instead
and modify the script to
$(".delete").on("click", function () {
var tr = $(this).closest('tr');
tr.remove();
});