mobile phone number validation help in Javascript
i need mobile phone number validation code help in Java script. please help.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jun 13, 2013, 11:02 PM
hi,
try following code.
var pattern = /^\(\d{3}\)\s*\d{3}(?:-|\s*)\d{4}$/
if (!pattern.test(string)) {
// mobile number is not valid...
}
also you can use regex like "/^\d{10}$/" this will allow you 10 digit.
hope this will help you.