Coin mask, error without thousand, inputmask

Asked

Viewed 453 times

1

I’m using the inputmask plugin.

I have two cases, when I Seto 4.5 I expect the mask to appear 4.50 and when Seto 10000.5 I expect it to show me 10,000.50. 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.50.

Fiddle Aqui: https://jsfiddle.net/xs0rLfto/25/

$(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>Try to set 4.50 int into input value</p>

Currency : <input id="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>

Options of the plugin:

  • digits: 2,
  • digitsOptional: false,
  • rightAlign: ,
  • radixPoint: ",",
  • groupSeparator: ".",
  • alias: 'currency',
  • prefix: " ",
  • removeMaskOnSubmit: true,
  • autoUnmask: true,
  • numericInput: true
  • First thing: Here you should only post in Portuguese, and not a half Frankenstein text in Portuguese half in English. Second thing, the Portuguese text does not match English, although they are similar.

  • Please check if the answer you give solves the problem or give feedback.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.