Skip to content Skip to sidebar Skip to footer

Jquery Masked Input Plugin Set Value Digits

$('.id').mask('999-99-9999-999-99'); I have the above mask input format i want to know if it is possible to have a predefined value for x number of characters like for example I w

Solution 1:

A workaround solution might be,

$.mask.definitions["9"] = null;
$.mask.definitions["^"] = "[0-9]";
$(".id").mask("639-27-^^^-^^^-^^");
  1. remove the definition for 9
  2. add a definition for numeric regex with a new key ex. ^
  3. use the new definition

fiddle

hope this helps

Solution 2:

You can do it like this using the plugin: $(".id").mask("639-27-9999-999-99"); As they used 9 as their number definition, you can change it in their source code with any other character.

Post a Comment for "Jquery Masked Input Plugin Set Value Digits"