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

191
Views
I want to fixed the decimal places of the textbox value

The function below also calculates the sum on run time. The txtRate is the textbox to be processed for the decimal fix.

$(function() {
  $("[id*=txtRate]").val("0");
});
$("body").on("change", "[id*=txtRate]", function() {
  var rate = parseFloat($.trim($(this).val()));
  if (isNaN(rate)) {
    rate = 0;
  }
  //Update the Rate TextBox.
  $(this).val(rate);
  //Calculate and update Row Total.
  var row = $(this).closest("tr");
  $("[id*=lblTotal]", row).html(parseFloat($(".quantity", row).html()) * parseFloat($(this).val()));

  //Calculate and update Grand Total.
  var grandTotal = 0;
  $("[id*=lblTotal]").each(function() {
    grandTotal = grandTotal + parseFloat($(this).html());
  });
  $("[id*=lblGrandTotal]").html(grandTotal.toString());
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

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!