Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
How to recalculate gross amount of dynamic inputs after remove row using JS

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();
        });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!