steve_gallagher
steve_gallagher

Reputation: 3898

How can I pre-format a phone number field using jQuery?

I'd like to have a phone number text field pre-formatted for a 10 digit number, like so (pipes not included, just delimiting field):

|(   )    -    |    

and have the numbers the user enters fill in appropriately

|(804) 479-1832|

I found a good script for formatting correctly as the digits are entered here, but nothing yet that delivers a preformatted structure.

Is there a simple library or link for this? Thanks.

Upvotes: 3

Views: 9397

Answers (1)

Claudio Redi
Claudio Redi

Reputation: 68440

Check this Masked Input Plugin. It seems to be what you're looking for.

Upvotes: 9

Related Questions