necesito algo de ayuda.
Estoy usando keyup para formatear la moneda, pero cuando el valor llega a 1000 o más, el cambio no funciona. Si elimino toLocaleString(), .change funciona. ¿Cómo puedo hacer que ambas funciones funcionen? Gracias.
Para tu información, estoy usando 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"); }); });