You have two separate problems.
Problem 1
You cannot have the same id multiple times on a page. This is just a basic HTML rule. You can use it only once. If you use the same id more than once, only the first time will be counted.
Decision
If you want to target multiple elements, use classes or specify one parent and capture it with element.firstElementChild
Problem 2
When you write .click , you tell the browser to keep track of when the user clicks on the element you are targeting.
However, this element must exist when the page first loads. This is because Javascript strings are only processed by the browser once. It reads your code, and if the element you want to click does not exist directly, your code is skipped.
Decision
So what you need to do to solve this problem is add a .click event .click to an element that is not dynamic. Remember that each click event skips the chain, starting from the innermost element that the user clicked, to that element's parent, next parent, and so on, until it reaches the body element. Therefore, if you add .click to the parent of the list, it will be installed correctly.
Using jQuery, it would be something like this:
$('#invoice_table_data').on('click', 'button.delete', function(event){
source share