0

I can't find a good solution for my problem. I'm working using ITALIAN standard, so... numbers like 1,234,000.00 in Italian is 1.234.000,00 (so...when typing inside input text: 1234000,00)

People, when typing inside input text box, always use comma to represent decimal, so I need a fast way to replace comma with dots during typing to facilitate my math operation in JavaScript when I need it. (using universal dot separator!) I don't want to use <input type="NUMBER", I need to use <input type="TEXT"> to prevent conflicts with others javascript plugins I already have.

Is there a good plugin to manage this? Probably I can use a standard function like:

$(document).ready(function() {
  $("input").on("change", function(e) {
    var newval = $(this).replace(",","."); 
    $(this).val(newval);
  });   
});

but I have to be sure this function IS ALWAYS the first executed before other onchange functions using the same element.

yuriy636
  • 11,171
  • 5
  • 37
  • 42
Giuseppe Lodi Rizzini
  • 1,045
  • 11
  • 33

0 Answers0