I'm trying to update a data-id on Edit button, but for some reason it's stay on one id, which has taken it from first pick. Here is my code:
The reason it stays on one id is that you have this line in your function:
$(name + " .edit, " + name + " .delete").attr("data-id", id);
After your first click - you set the current it to all of the
.delete elements in your document.
You can just remove this line and your code should work as you expected.