0

Using this plugin : http://digitalbush.com/projects/masked-input-plugin/

Is it possible to make something like this happen?

(As the user inputs the phone number...)

1__-___-____

18_-___-____

186-___-____

186-6__-____

186-612-____

186-612-3___

186-612-34__

186-612-345_

186-612-3456

1-866-123-4567

Thank you in advance :)

Fierceblood
  • 360
  • 1
  • 2
  • 10

1 Answers1

0

Why not follow your final format?

1-866-123-4567

So, your code would look like this:

$("#phone").mask("(9)-999-999-9999");

Or without the bracket:

$("#phone").mask("9-999-999-9999");

See my Fiddle Demo.

Edper
  • 9,144
  • 1
  • 27
  • 46
  • Because the user would always have to put 11 digits, even for a local phone number which only requires 10... 999-999-9999 would be a valid 10 digits local phone number and 9-999-999-9999 would be a valid 11 digits long distance phone number – Fierceblood Nov 03 '13 at 08:00