0

I Want to separate numbers (3 by 3 Decimal from right). if our number is:

1000

i want it change to:

1.000

and if:

10000000

change to:

10.000.000

 <input class="myInput" style="width: 100px!important" type="number"  step="5000" value="0" min="0" max="99999999" />

$('.myInput').on('blur', function() {
    var amount = $('.myInput').val().replace(/^\s+|\s+$/g, '');
    if( ($('.myInput').val() != '') && (!amount.match(/^$/) )){
        $('.myInput').val( parseInt(amount).toFixed(3));
    }
});

JSFiddle

ITSolution
  • 398
  • 2
  • 9
  • 21
  • `toFixed(3)` adds 3 decimal places to your number, that's not what you want. – chiccodoro Jun 03 '14 at 06:20
  • @chiccodoro those answeres not working with my question!! did you test it before marked duplicate?? – ITSolution Jun 03 '14 at 06:36
  • Yes, I tested it. If you have issues with those answers it is perfectly valid to post a new question (or edit this and vote for reopening) - ***IF*** you refer to that answer and explain in ***DETAIL*** what exactly is not working for you or in what way your problem differs from that one. – chiccodoro Jun 03 '14 at 06:38
  • @chiccodoro if you test it, so give me a jsfiddle.. i almost test it most of themes, not working with my code. why marked as duplicated that i should ask a question twice!! – ITSolution Jun 03 '14 at 06:44

0 Answers0