forked from stripe-archive/jquery.payment
-
Notifications
You must be signed in to change notification settings - Fork 104
Phone Number (US & Canada)
Omar Shammas edited this page Sep 13, 2013
·
1 revision
Formats the phone number in the (111) 111 - 1111
format :
- Limits to 10 numbers
- Restricts inputs to numbers
- Includes
(
and)
around the area code - Includes a
-
between the prefix (first 3 digits after the area code) and the line number (last 4 digits)
$('input.phone_number').formance('format_phone_number');
Validates the phone number:
- Does NOT validate whether the number actually exists.
- Validates numbers
- Validates length (after stripping away non digit characters)
$("<input value='6131231234' />").formance('validate_phone_number'); // true
$("<input value='(613) 123 - 1234' />").formance('validate_phone_number'); // true
$("<input value='(613) 123 - 12345' />").formance('validate_phone_number'); // false