Questions tagged [jquery-inputmask]

jquery.inputmask is a jquery plugin which create an input mask. An inputmask helps the user with the input by ensuring a predefined format. This can be useful for dates, numerics, phone numbers, ...

jquery.inputmask

Copyright (c) 2010 - 2013 Robin Herbots Licensed under the MIT license (https://www.opensource.org/licenses/mit-license.php)

jquery.inputmask is a jquery plugin which create an input mask.

An inputmask helps the user with the input by ensuring a predefined format. This can be useful for dates, numerics, phone numbers, ...

Highlights:

  • easy to use
  • optional parts anywere in the mask
  • possibility to define aliases which hide complexity
  • date / datetime masks
  • numeric masks
  • lots of callbacks
  • non-greedy masks
  • many features can be enabled/disabled/configured by options
  • supports readonly/disabled/dir="rtl" attributes
  • support data-inputmask attribute
  • multi-mask support
  • regex-mask support

Usage:

Include the js-files which you can find in the dist-folder. You have the bundled file which contains the main plugin code and also all extensions. (date, numerics, other) or if you prefer to only include some parts, use the separate js-files in the dist/min folder.

The minimum to include is the jquery.inputmask.js

html

<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.inputmask.js" type="text/javascript"></script>

Define your masks:

javascript

$(document).ready(function(){
   $("#date").inputmask("d/m/y");  //direct mask
   $("#phone").inputmask("mask", {"mask": "(999) 999-9999"}); //specifying fn & options
   $("#tin").inputmask({"mask": "99-9999999"}); //specifying options only
});

or

html

<input data-inputmask="'alias': 'date'" />
<input data-inputmask="'mask': '9', 'repeat': 10, 'greedy' : false" />
<input data-inputmask="'mask': '99-9999999'" />

javascript

$(document).ready(function(){
    $(":input").inputmask();
});

Learn more:

190 questions
2
votes
1 answer

How can I get input elements using inputmask to not revert changes to the previous value when using them within a table sorted with tablesorter?

I have been spending a fair amount of time working on an issue with input elements, which are using inputmask, within a table sorted using tablesorter. When the user enters an input in the masked field after the updateRows event has been triggered…
Aesonus
  • 56
  • 4
2
votes
0 answers

jquery Inputmask change comma to dot on decimal

I was using https://github.com/RobinHerbots/Inputmask, but old version. It was not working properly on mobile devices I upgraded to latest version. And now I have a problem. I was using my own function to change comma to…
Chris
  • 785
  • 5
  • 12
  • 29
2
votes
3 answers

Why is Inputmask not properly handling a date?

Glancing through the source, it looks like loading the date extensions should allow me to use a mask like mm/dd/yyyy. Expected behavior: clicking into the field should allow me to enter something like 12/25/2018, replacing the mask with my input as…
crenshaw-dev
  • 7,504
  • 3
  • 45
  • 81
2
votes
1 answer

How to import and use RobinHerbots' Inputmask in Aurelia

I'm trying to use RobinHerbots' Inputmask in Aurelia but cannot seem to import it correctly. I've come across people discussing using this plugin in Aurelia but I could not find specific documentation on how to do this. After npm i inputmask…
flea
  • 45
  • 8
2
votes
3 answers

Jquery inputmask "dd-mm-yyyy hh:mm"

How to configure to achieve "dd-mm-yyyy hh:mm" format? $('input').inputmask({ mask: "1-2-y h:s", placeholder: "dd-mm-yyyy hh:mm", leapday: "29-02-", separator: "-", …
Sodiaan
  • 341
  • 1
  • 3
  • 10
2
votes
1 answer

How to use jQuery's inputmask in AdminLTE when included via composer

Short version How do I use inputmask from a twig inheriting from the avanzu/AdminThemeBundle base? Context I'm using the AdminLTE admin panel template (https://adminlte.io/) in a symfony3 project. To do so, I use the Avanzu project…
Xavi Montero
  • 9,239
  • 7
  • 57
  • 79
2
votes
1 answer

How to mask input with Jquery in MVC5?

Last days, I try to develop MVC web application in .Net Framework. I try to mask input on form . I have download Jquery masked input and I wrote that code in my view section. @section Scripts{