XXX Chats

european american dating website

Javascript function for validating numbers

I found this code in some website, and it works perfectly.

It validates that the phone number is in one of these formats: (123) 456-7890 or 123-456-7890 The problem is that my client (I don't know why, maybe client stuffs) wants to add another format, the ten numbers consecutively, something like this: 1234567890.

I'm using this regular expression, First off, your format validator is obviously only appropriate for NANP (country code 1) numbers.

If you using on input tag than this code will help you.

I write this code by myself and I think this is very good way to use in input. It will help user to correct their format on input tag.

Google has a good library for handling phone numbers in Javascript: https://github.com/googlei18n/libphonenumber. I would prefer using these, because this one must be really well tested in production.

asdf# 55555555 (6505552368) 2 (757) 622-7382 0 (757) 622-7382 -1 (757) 622-7382 2 757 622-7382 10 (757) 622-7382 27576227382 (275)76227382 2(757)6227382 2(757)622-7382 (555)5(55?

During web development, nearly always, we need to provide input validation on even simple web forms.

Comments Javascript function for validating numbers