Reputation: 9216
I am using the jquery.inputmask plugin and have recently run into an issue. We're using the plugin to format input fields for different telephone numbers per country, for example:
+1 (___) ___-____ [+1 (999) 999-9999]
The North American Numbering plan.
+33 __-__-__-__ [+33 99-99-99-99]
The french numbering plan.
These work, but the issue arises when we hit Germany.
+4_ ___-___-___ [+49 999-999-999]
The 9 is the number used by the input mask plugin. It incorrectly believes the literal +49
we want to add to the field is part of the values the mask is taking. We need to allow 9 to show up in the mask and not be considered a token. Is there a way to change the numeric mask indicator from 9 to something else?
Upvotes: 3
Views: 1920
Reputation: 3818
Try escaping the 9:
$(".german").inputmask('+4\\9 999-999-999');
Upvotes: 2
Reputation: 3200
Try to create new mask definition:
$.extend($.inputmask.defaults.definitions, {
'n': { //masksymbol
"validator": "[0-9]",
"cardinality": 1
}
}
And then your mask should looks like:
[+4n nnn-nnn-nnn]
Upvotes: 1