Tuesday, 7 July 2015

How to Mobile validation with javascript

<script type="text/javascript">

   function chkform(form)

   {
 
   // Phone number validation
re=  /^\d{10}$/;
if(!re.test(form.txtphonenum.value))
{
alert("Enter Only  10 Digit Number");
form.txtphonenum.focus();
return false;
}
   }
 
   </script>
 
   <form name="f1" method="post" style="margin-left: 500px;">
   <input type="text" name="txtphonenum" placeholder="Enter Phone number"/>
   </form> 

No comments:

Post a Comment