Javascript input mask

The jSuites javascript mask plugin is a lightweight script to force certain accepted formats in HTML input fields.

Using the mask plugin, you can easily define Dates, Numbers, Currency, Phone and much other masked strings.

Parse programmatically

<script src=""></script>
<link rel="stylesheet" href="" type="text/css" />

<button id='btn'>Alert:'447473725104', '(00) 000000 0000')</button>

document.getElementById('btn').addEventListener('click', function() {
    var value ='447473725104', '(00) 000000 0000');



The following example show how to alert when the data input is completed.

<script src=""></script>
<link rel="stylesheet" href="" type="text/css" />

<p>What is your birthday? <strong>dd/mm/yyyy</strong></p>
<input id='date' data-mask='dd/mm/yyyy'> <span id='status'></span>

date.onkeyup = function(e) {
    document.getElementById('status').innerHTML = '';

    if ('data-completed') == 'true') {
        document.getElementById('status').innerHTML = 'Complete';
    } else {
        document.getElementById('status').innerHTML = 'Incomplete';

Input mask options

Token Target
a Any letter
0 Any Number
#.## Formatted number
#,## Formatted number
# ## Formatted number
yyyy Year four digits
yy Year two digits
mm Month
dd Day
hh24 Hour 24
hh Hour 12
mi Minutes
ss Seconds
\a Letter "a" (escape for a)
\0 Number "0" (escape for 0)
[-] Number signal (- or +)

NOTE: All tokens should be lowercase.