Hope someone can advise.
I wondering how to recalculate the gross amount of dynamic inputs after removing a row I have a function which is calculate the gross amount after adding a new row correctly, but when removing a row nothing happens.
Thanks in advance.
CalcSum function:
function CalcSum(){
let gross = 0;
$(".subtotal").each(function() {
let val = $(this);
gross += parseFloat(this.tagName == 'INPUT' ? val.val() : val.text());
});
tax = gross*0.10;
$('#tax').val(tax.toFixed(2));
gross_amount = gross+tax;
$('#gross_amount').val(gross_amount.toFixed(2));
}
Removing function:
$(document).on('click', '.remove_row', function(){
var row = $(this).closest('tr');
row.fadeOut("normal", function() {
row.remove();
});
CalcSum();
});