Im using a jquery masked input plugin and should have a phone field in the following format:
1 (222) - 000 - 1114
my code is as follows:
$("#myPhone").mask("9 (999) - 999 - 9999");
now I canβt get it working to make the first digit optional, but the rest is mandatory. Thus, the following numbers are valid :
1 (222) - 000 - 1114 (222) - 000 - 1114
and the following numbers are invalid
1 (222) - 000 - 11 (222) - 00 - 0011
using "? 9 (999) - 999-9999" will not work as it makes all this optional
If this cannot be done in masks, can someone help me with regex to achieve this?
Ggio
source share