Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 747 Bytes

File metadata and controls

41 lines (32 loc) · 747 Bytes

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>