Insert comma automatically while typing

0

When you enter a value, is there any way you can already do the correction by entering commas and points in the live?

EX: Press 4 + 3 + 6 on the keyboard Input ja mosta = 4.36

EX: Press 4 + 3 + 6 + 8 + 8 + 8 on the keyboard Input ja mosta = 4,368.88

I was able to do it using the jquery plugin mask but I would like to know if it is possible using pure jquery

     $( '#preco' ).keyup( function() {
     $('#preco').mask("#.###,##", {reverse: true});
     });
    
asked by anonymous 16.01.2018 / 20:25

1 answer

0

You can use JQuery.mask and pass the format you want, eg:

$('.classeNoInput').mask("#.##0,00", {reverse: true});

Follow the documentation link

This solution is for other formats such as date, zip, phone, etc.

    
16.01.2018 / 20:33