Question:
i have a question about my function remove(btn). I can’t quite figure it out why its not working. This function have a button when i click it it is supposed to add it to the remove table and increase the counter, meanwhile decrease the counter from the main table and remove the row from there. Here is my code:Answer:
Your append is moving the row which means this will DELETE the row regardless of which table it is in:row.parentNode.removeChild(row);
I strongly recommend counting the actual rows
Also delegating (eventListener on the tbody) makes the code simpler and allows us to remove the inline event handlers.
Lastly an array to keep the data in and a map to render it
If you have better answer, please add a comment about this, thank you!