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

151
Views
How to using jquery .each for total sum for the qty x price = sum total

how to using jquery .each for qyt + price = sum total , im using javascript but have a bug if i fill with any colom and i edit input antoher colom, total_sum_value wrong

<script>
function sum(x) {
    var qty = $("#product_qty" + x).val();
    var price = $("#p_price" + x).val();
    var productx = 0;

    if (qty == "") {
        $("#product_qty").val("");
        // alert('Qty Request');
    } else {
        var product_tot = parseInt(qty) * parseInt(price);
        document.getElementById("product_tot" + x).value = product_tot;

        for (let i = 1; i <= x; i++) {  
            var totalhit = $("#product_tot" + i).val();       
            productx = parseInt(productx) + parseInt(totalhit);
        }
        document.getElementById("total_sum_value").value = productx;
    }
}

im using ajax for append for the table

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!