So I have a currency inputmask defined like this:
$(".value_price").inputmask('decimal', {
'alias': 'numeric',
'groupSeparator': ',',
'autoGroup': true,
'digits': 2,
'radixPoint': ",",
'digitsOptional': false,
'allowMinus': false,
'prefix': 'R$ ',
'placeholder': '00',
'removeMaskOnSubmit' : true,
'numericInput': true,
'greedy': false,
'skipOptionalPartCharacter': "",
'clearMaskOnLostFocus': false
});
Mostly it works just fine, but I've encountered a weird problem that I don't know if it is a bug or I'm just doing it wrong.
If I run $('#value').val(149700). The masked input shows the value R$ 1.497,00 correctly, that's the expected.
But, if I run $('#value').val(1497000) (one more zero), now the masked input shows R$41.970,00 Instead of the expected R$ 14.970,00
The one extra zero, broke the prefix (no more space after it) and somehow changed the order of the numbers??
Also, when I try to run $('#value').inputmask('unmaskedvalue') on the broken input, it returns the raw value, still masked.
Is this a bug? Or am I doing something wrong here?