if (isNaN(mobile)) // else if(num.test(mobile) == false) { alert("Invalid phone number"); $( "#mphone" ).focus(); $('#mphone').val(""); return false; }
if (! /^\d+$/.test(mobile) ){ //This does not contain digits. } //or if you want to check for a certain number of digits if (! /^\d{8}$/.test(mobile) ){ //This string does not have 8 digits. }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)