Created
December 3, 2013 18:10
-
-
Save enopanen/7774377 to your computer and use it in GitHub Desktop.
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
<!-- jQuery: Validating an email. --> | |
$('#txtEmail').blur(function(e) { | |
var sEmail = $('#txtEmail').val(); | |
if ($.trim(sEmail).length == 0) { | |
alert('Please enter valid email address'); | |
e.preventDefault(); | |
} | |
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z] | |
{2,4}|[0-9]{1,3})(\]?)$/; | |
if (filter.test(sEmail)) { | |
alert('Valid Email'); | |
} | |
else { | |
alert('Invalid Email'); | |
e.preventDefault(); | |
} | |
}); | |
<!-- HTML: Validating an email--> | |
<asp:TextBox id="txtEmail" runat="server" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment