Open mattsones opened 7 years ago
I'm trying to mask a 7 or 10 digit phone number with an optional extension.
Goal:
input --> result 1234567 --> 123-4567 1234567890 --> (123) 456-7890 12345678901234 --> (123) 456-7890 x1234
Here's my attempt:
$("input").inputmask({ "mask": "[(999) ]999-9999[ x99999]", // "numericInput": true, "skipOptionalPartCharacter": " ", "greedy": false });
Result 1234567 --> (123) 456-7___ 1234567890 --> (123) 456-7890 12345678901234 --> (123) 456-7890 x1234
If I turn numeric input on, I get the reverse problem: 1234567 --> _-12 x34567 1234567890 --> __1-2345 x67890 12345678901234 --> (_12) 345-6789 x01234
How can I get the desired result?
I was able to find a workaround with multiple masks:
$("input").inputmask({ "mask": ["999-9999","(999) 999-9999[ x9{1,5}]"], "greedy": false });
I'm trying to mask a 7 or 10 digit phone number with an optional extension.
Goal:
input --> result 1234567 --> 123-4567 1234567890 --> (123) 456-7890 12345678901234 --> (123) 456-7890 x1234
Here's my attempt:
Result 1234567 --> (123) 456-7___ 1234567890 --> (123) 456-7890 12345678901234 --> (123) 456-7890 x1234
If I turn numeric input on, I get the reverse problem: 1234567 --> _-12 x34567 1234567890 --> __1-2345 x67890 12345678901234 --> (_12) 345-6789 x01234
How can I get the desired result?