Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

129
Visualizações
.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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda