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

124
Views
.change not working when 'm using toLocaleString on keyup

i need some help.

I'm using keyup to format the currency, but when the value reach 1000 or more the .change doesn't work. If i remove the toLocaleString(), the .change works. How can i make both function work? Thank you.

FYI i'm using laravel.

$("#amount").change((event) => {
    updateAmountInfo($('#amount').val())
})

// End of Check Balance and Amount //
$("#amount").on("keyup", function(event) {
    checkBalance();
    var selection = window.getSelection().toString();
    if ($.inArray(event.keyCode, [38, 40, 37, 39]) !== -1) {
        return;
    }

    var $this = $(this);
    var value = $this.val();

    var input = value.replace(/[\D\s\._\-]+/g, "");

    input = input ? Number(input) : 0;
    
    $this.val(function() {
        return (input === 0) ? "" : input.toLocaleString("en-US");
    });
});
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!