I am add table row dynamically on button.click event.
If i use this code delete row is not functioning.
var count = 1;
$('button[id^="product"]').click(function () {
//adding row to table : WORKING FINE
count++;
});
$(".del_row").click(function() {
//removing row // NOT WORKING
count--;
});
If i try code bwloe. It is working but the count goes back to 0; and – on 2nd click 🙁
$('button[id^="product"]').click(function () {
//adding row to table : WORKING FINE
count++;
$(".del_row").click(function() {
//removing row
count--;
});
});
1 Answer