0.4.0 • Published 6 years ago
automask v0.4.0
Instable version
This version is below version 1.0.0 and some unexpected behaviors may occur.Install
npm i automaskor just import the javascript into /dist/web/ into your web project.
Import
Module
Just import with require and use:
require('automask')Web
Download script into /dist/web/ folder and import normally:
<script type="text/javascript" src="automask.min.js"/>Usage
All settings are usable on HTML and works on IE11+ browsers.
<!-- MAC Address -->
<input mask="__:__:__:__:__:__" accept="0-9A-Fa-f" />
<!-- show the empty mask -->
<input mask="__:__:__:__:__:__" accept="0-9A-Fa-f" show-mask="true" />
<!-- Percentage -->
<input mask="__0,0" dir="backward" suffix="%" />
<!-- Money -->
<input mask="___.__0,00" dir="backward" prefix="$ " persist="\d," />Settings
All AutoMask settings are enabled with HTML. Just set the attribute and use.
maskto define your pattern;prefixto set an prefix;suffixto set an suffix;show-maskto set whether or not to display the mask;acceptRegular Expression for accepted characters (default is only numbers);persistRegular Expression to set what characters submit on form.- BETA
dirto set fill direction;
Mask
The mask accepts all characters and have only two special characters, the _ and 0.
These characters are where your value will stay, and the 0 will works like an zero pad (for example, to pad the money or percentage).
Dir
The dir set the completion direction. Accept two values, backward and forward. The default value is forward.
Author
- Created and maintained by Emerson C. Romaneli (@ECRomaneli).