You are rendering a button with same id
multiple times which is invalid html
and every time you apply a selector on it, it selects the first element it finds in DOM with id deleted. Make the id
unique by appending the id that is coming in Model and add a class
attribute to the button:
<button type="button" class="delete" id="delete_@(Model.listUsers[i].ID)" data-id="@Model.listUsers[i].ID">Delete</button>
Now apply a click event on the class:
$(".delete").on("click", function () {
var tr = $(this).closest('tr');
tr.remove();
});