Created
April 14, 2016 14:05
-
-
Save quyen91/9f6ccaa4871145633757adb06cf031d2 to your computer and use it in GitHub Desktop.
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
$('#myModal').on('submit', function(e) { | |
var rex = /^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$/ | |
var email = $('#email'); | |
if(!email.val()){ | |
$('#error-show').html("<small>* Email required</small>"); | |
e.preventDefault(); | |
}else{ | |
if(!rex.test(email.val())){ | |
$('#error-show').html("<small>* Invalid email</small>"); | |
e.preventDefault(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment