A Vanilla JS Masked Input Library Plugin

Input Masks is a native vanilla JavaScript library for masking input fields with custom mask formats, placeholders, and callbacks.

input mask example, jquery input mask example, html input mask, input mask javascript, input mask open source projects on github

Simple jQuery Plugin for Inputting Special Characters | specialinput.js

How to make use of it:

Simply include the basic JavaScript file on the web page.

<script src="index.js"></script>

JavaScript hides a specific input field.

inputMask(document.getElementById('test_field'), {

  /**
   * mask
   *
   * Defines the format of the mask.
   * Built-in identifiers:
   *   #: [0-9]
   *   a: [A-Za-z]
   */

  mask: '###-##-####',

  /**
   * placeholder
   *
   * A value to be displayed when the
   * field is in focus. Defaults to the
   * mask string.
   */

  placeholder: '___-__-____',

  /**
   * onMatch
   *
   * A function to be run on blur if the
   * input value matches the mask.
   *
   * @param {String} The passing string
   */

  onMatch: function(value) {
    console.log('Value ' + value + ' matches the input mask.');
  },

  /**
   * onFail
   *
   * A function to be run on blur if the
   * input value does not match the mask.
   */

  onFail: function() {
    console.log('No match was found for that value.');
  },

  /**
   * clearOnFail
   *
   * When true, the input field will have its
   * value cleared on blur if the value does
   * not match the mask. Defaults to true.
   */

  clearOnFail: false

});

Minimalist Input Mask Library Plugin/Github


See Demo And Download

Official Website(slwulf): Click Here

This superior jQuery/javascript plugin is developed by slwulf. For extra Advanced Usages, please go to the official website.

Related Posts

Vector-Graphs-smartGraph

Generating Beautiful Vector Graphs With jQuery | smartGraph

SmartGraph is a free and easy-to-use JavaScript library to create beautiful vector diagrams with many customizations. This plugin allows developers to create dynamic, responsive, draggable vector graphics…

vue-image-slider-transition

Image Slider With 20 Cool Transitions Component | vue-flux

Vue flux is an image slider developed with Vuejs 2 that comes with 20+ nice transitions out of the box. Included transitions 2D transitions Fade: Fades from…

simple-parallax-scrolling

Simple background Image Parallax Scroll Plugin In jQuery

Background parallax effect is a simple jQuery background image without any library. Uses jQuery’s scroll() function to track the scroll event and applies the exact parallax scroll…

bootstrap-color-picker-plugin

Modular Color Picker Plugin for Bootstrap | BS Colorpicker

Bootstrap Colorpicker is a standard color picker plugin for Bootstrap 4. Colorpicker Plugin for Bootstrap 5/4/3 frameworks that allow you to add a color picker to an…

gdpr-iframe-manager-js

GDPR Friendly iFrame Manager In Vanilla JS | iframemanager

IframeMananger is a lightweight JavaScript plug-in that helps you to comply with GDPR by completely removing iframes at first and setting a notice related to that service….

diagonal-slider-anime-js

Diagonal Thumbnails Carousel Slider | Anime.js

Diagonal Slider is a cool mini carousel made with Anime.js JavaScript library. It takes a bunch of pictures and turns them into a circular user interface where…