Wednesday, February 8, 2012

mobile number validation in javascript



mobile number validation is very important topic in javascript , we are try to say how to use mobile number validation in javascript , i think this is very useful for you thanks













<script>
function mobileNoValidation()
{
var mobile=parseInt(document.getElementById('mobile').value );




//var reg = /^([0-9]{10,10})$/;
var reg = /^\d{10}$/;




if(reg.test(mobile) == false) {


alert('Please Enter Valid mobile number');  document.getElementById('mobile').focus();
return false;
}
}
</script>
<form action='#'>
<input type="text" name="mobileNo" id="mobile" value="pease enter mobile no " maxlength="10" onClick="(this.value='')" onkeypress="return IsNumber(event , this);"  />


<input  type="submit" value="Submit"  onclick=" return  mobileNoValidation();" maxlength="12"  />


</form>

2 comments:

  1. thanks alot. it really helps me out.. god bless u.. thanx a ton

    ReplyDelete

If you Satisfied , Please Leave a comment