Button on Table, name table1 not working

Whing Dela Cruz
Whing Dela Cruz used Ask the Experts™
Hi Experts, I have two tables, Table1 and Table2. On table2, I have four columns, one of it is button. The button of Table2 is working properly while on Table1 is not while they are just the same. I used "$('#Table1 tbody').append($(e).parent().clone());" to copy data from Table2 to table1. I thought that I can run the button the same after copying on it. I attached the html to understand the experts. I wish to run the same functions on table1 after copying the data from table2. Thank you!
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Banshi lal dangiFull Stack Developer

Hi, I have made the correction in your HTML file Javascript code and attached the updated file again.
Full Stack Developer
Sorry, I think I were missed to attach the file. So I am attaching it now.
Distinguished Expert 2017
You can use delegate method (delegete) or on() method.

  $( "table" ).delegate( "button", "click", function() {
     let tr = $(this).closest('tr');
    let a = tr.find('td:eq(1)').html();

Open in new window


Thank you guys..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial