Simplest Number Input Mask Plugin with jQuery - Simple Mask

Simplest Number Input Mask Plugin with jQuery - Simple Mask
File Size: 108 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Simple Mask is a tiny jQuery plugin to make masks on input fields that allows the users to enter numbers in a certain format.

Also has the ability to jump automatically after certain numbers in an input to the next field.

Installation:

# NPM
$ npm install jquerysimplemask --save

# Bower
$ bower install jquerysimplemask --save

How to use it:

1. Include the jQuery simple mask plugin after loading jQuery library.

<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="src/jquery.SimpleMask.js"></script>

2. Call the plugin on the input fields and custom the mask rules like this:

$('input').simpleMask({ 
  'mask': ['####-####','#####-####'] 
});

3. More configurations.

// auto jump to next input fields 
// e.g. $('#input-2')
nextInput: null,

// onComplete event
onComplete : null

Changelog:

2018-07-19

  • v1.0.6

2017-05-10

  • Added select on focus on nextinput is true.

2014-12-09

  • fixed.

2014-11-22

  • Added helper masks: date, cpf, cnpj, cep, phone;

This awesome jQuery plugin is developed by DevUtils. For more Advanced Usages, please check the demo page or visit the official website.