nihlton / input-mask

Numerical Input Masking [ BETA ]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TODO: convert to hook!

demo: http://gregtaff.com/misc/input-mask/

save input-mask.js to your project and then import it when you need it.

Usage:

import InputMask from './input-mask/input-mask'
this.phoneMask = new InputMask('(___) ___ - ____', '_')
<label>
	<span>phone number</span>
	<input 
		type="text" 
		onKeyDown={this.phoneMask.keyDownHandler}
		onKeyUp={this.phoneMask.keyUpHandler} />
</label>

first argument is the input mask. its a string representing decoration text, and numbers. the numbers are indicated by the second argument.

About

Numerical Input Masking [ BETA ]


Languages

Language:JavaScript 89.8%Language:CSS 5.2%Language:HTML 5.1%