Currency mask, error without thousands, inputmask

1

I'm using the inputmask plugin.

I have two cases, when I hedge 4.5 I expect the mascara to appear 4.50 and when I get 10000.5 I expect it to show me 10,000,000. But 4.5 shows me 40.50, how do I show 4.50? Already the case of 10000.5 works correctly giving me 10,000.00.

Fiddle Here: link

$(document).ready(function(){
  $('.value').click(function(){
  	var dataValue= $(this).attr('data-value');
     $('#mask').val(dataValue);
  });
});

$('#mask').inputmask({
  digits: 2,
  digitsOptional: false,
  rightAlign: false,
  radixPoint: ",",
  groupSeparator: ".",
  alias: 'currency',
  prefix: " ",
  removeMaskOnSubmit: true,
  autoUnmask: true,
  numericInput: true
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><p>Trytoset4.50intintoinputvalue</p>Currency:<inputid="mask" type="text" />
<button class="value" data-value="4.5">
Set Value 4.50 Expect to be 4,50
</button>

<button class="value" data-value="10000.5">
Set Value 10000.50 Expect to be 10.000,50
</button>

Plugin options:

  • digits: 2,
  • digitsOptional: false,
  • rightAlign: false,
  • radixPoint: ",",
  • groupSeparator: ".",
  • alias: 'currency',
  • prefix: "",
  • removeMaskOnSubmit: true,
  • autoUnmask: true,
  • numericInput: true
asked by anonymous 30.08.2018 / 06:15

0 answers