Last active
December 11, 2015 10:09
-
-
Save akmur/4585189 to your computer and use it in GitHub Desktop.
Simple email validation
This file contains 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
$('input#submit').click(function(){ | |
var email = $('input#email').val(); | |
var flag = true; | |
$('input.req').each(function(){ | |
// if the input.req is empty... | |
if ($(this).val() == "") { | |
$(this).nextAll('span:first').fadeIn(); | |
flag = false; | |
} else { | |
// if the input#email field has no @ sign... | |
if(email.indexOf('@') == -1) { | |
$('form span').fadeIn(); | |
flag = false; | |
} | |
} | |
}); | |
return flag; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment