Skip to content

Latest commit

 

History

History

vanilla

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

SimpleMaskMoney Example Vanilla JS

Getting started

First, install it.

  npm i simple-mask-money --save

Or you can just from github cdn:

<script src="/lib/simple-mask-money.umd.js"></script>

Then, use it as follows:

<body>
  <input type="text" />

  <script>
    const optionsUSD = {
      afterFormat(e) { console.log('afterFormat', e); },
      allowNegative: false,
      beforeFormat(e) { console.log('beforeFormat', e); },
      negativeSignAfter: false,
      prefix: '$',
      suffix: '',
      fixed: true,
      fractionDigits: 2,
      decimalSeparator: ',',
      thousandsSeparator: '.',
      cursor: 'end'
    };

    SimpleMaskMoney.setMask('input', optionsUSD);
  </script>
</body>