
Question:
$(".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 want the first 5 letters to have a default and unchangeable numbers.
Sample number will be
639-27-9999-999-99
here the numbers 639-27-
should be always there meaning when the input has focus it will automatically be put there and cannot be changed.
F.Y.I
<a href="http://digitalbush.com/projects/masked-input-plugin/" rel="nofollow">Plugin</a>
Answer1:A workaround solution might be,
$.mask.definitions["9"] = null;
$.mask.definitions["^"] = "[0-9]";
$(".id").mask("639-27-^^^-^^^-^^");
<ol><li>remove the definition for 9
</li>
<li>add a definition for numeric regex with a new key ex. ^
</li>
<li>use the new definition </li>
</ol><a href="http://jsfiddle.net/dzqrr0qm/" rel="nofollow">fiddle</a>
hope this helps
Answer2: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.