Monday, April 7, 2014

javascript code for mobile number verification

function phonenumber(inputtxt)
{
  var phoneno = /^\d{10}$/;
  if(inputtxt.value.match(phoneno))
        {
      return true;
        }
      else
        {
        alert("Not a valid Phone Number");
        return false;
        }
}

<form name="gqform">
<input type="text" name="phone" onblur="phonenumber(document.gqform.phone)" required/>
</form>