All Type Coding

Search Here

Email validation

 function validateEmailId(obj, evt) {

            var txtEmail = obj.id;
            var Email = $('#' + txtEmail).val();

            var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
            if (Email.match(mailformat)) {
                return true;
            }
            else {

                alert("Invalid email id entered! Please enter valid email id");
                $('#' + txtEmail).val('');
                $('#' + txtEmail).focus();
                return false;
            }
        }

No comments :

Post a Comment