Feature-rich Input Mask JavaScript Library – vanilla-masker

Category: Form , Javascript , Recommended | September 11, 2018
Author: vanilla-masker
Views Total: 2,693
Official Page: Go to website
Last Update: September 11, 2018
License: MIT

Preview:

Feature-rich Input Mask JavaScript Library – vanilla-masker

Description:

vanilla-masker is a vanilla JavaScript library that makes it easy to mask and format values you user typed in an input field.

Install the vanilla-masker:

# NPM
$ npm install vanilla-masker

# Bower
$ bower install vanilla-masker

How to use it:

Import the vanilla-masker or directly include the JavaScript file ‘vanilla-masker.min.js’ into the webpage.

<script src="vanilla-masker.min.js"></script>

Use the vanilla-masker to format currency & money typed in the input field.

VMasker(document.getElementById("input")).maskMoney();
// with options
VMasker(document.getElementById("input")).maskMoney({
  precision : 2,
  separator: ",",
  delimiter: ".",
  unit: "",
  suffixUnit: "",
  zeroCents: ,""
  lastOutput: ""
});

Use the vanilla-masker to format numbers typed in the input field.

VMasker(document.getElementById("input")).maskNumber();

Maks the input field using custom patterns.

VMasker(document.getElementById("input")).maskPattern('(99) 9999-9999');

Changelog:

09/11/2018

  • Fix parsing of money strings already containing separators

08/12/2017

  • Update to v1.2.0

You Might Be Interested In:


Leave a Reply