All Type Coding

Search Here

Valid Mobile number validation

 function validateMobileNo(obj, evt) {

            var txtMblNo = obj.id;
            var MobileNo = $('#' + txtMblNo).val();
            var mob = /^[7-9]{1}[0-9]{9}$/;

            if (MobileNo.length < 10) {
                alert("Please enter 10 digits mobile number");
                $('#' + txtMblNo).val('');
                $('#' + txtMblNo).focus();
                return false;
            }

            if (mob.test(obj.value) == false) {
                alert("Please enter valid mobile number.");
                $('#' + txtMblNo).focus();
                $('#' + txtMblNo).val('');
                return false;
            }

        }

No comments :

Post a Comment