Created
June 25, 2019 22:22
-
-
Save rdallaire/8e4de4f18291b716ec91a9ea6ae7f33b to your computer and use it in GitHub Desktop.
jquery email validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#cases-email').keyup(function(){ | |
var email = $('#cases-email').val(); | |
var filter = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
if (!filter.test(email)) { | |
//alert('Please provide a valid email address'); | |
$("#cases-error-email").text('Please enter a valid email.'); | |
$('#support-contact-cases .button').attr('disabled', true); | |
email.focus(); | |
//return false; | |
} else { | |
$('#cases-error-email').text(''); | |
$('#support-contact-cases .button').attr('disabled', false); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment