Mobile phone number validation help in Javascript
i need mobile phone number validation code help in Java script. please help.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 13, 2013, 7:02 PM EDT
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.