0
I have this function for monetary values:
function formatMonetary(v){
v = v.replace(/\D/g,"");
v = v.replace(/(\d{1})(\d{15})$/,"$1.$2");
v = v.replace(/(\d{1})(\d{11})$/,"$1.$2");
v = v.replace(/(\d{1})(\d{8})$/,"$1.$2");
v = v.replace(/(\d{1})(\d{5})$/,"$1.$2");
v = v.replace(/(\d{1})(\d{1,2})$/,"$1,$2");
return v;
}
When I use the number 1 or 1.1 it returns to me:
0,01
0,11
I wanted her to return the number to me this way:
1,00
1,10
In other words, I wanted her to return the number to me by completing the decimals on the left, so it’s possible?
Edson, I marked it as a duplicate of another question that has a lot of information about what you’re looking for. Tell me if you still can’t find an answer.
– Sergio
And if you change the typing direction of the field in css:
direction: rtl
? It’s a long shot, a real kick...– DontVoteMeDown
Some sites have this mask, like Bradesco and Santander, if you type 20 he understands it is 20.00, if you type 201 he understands it is 20.10, I could not reproduce
– Edson Cezar