Email ID Validation Using JavaScript Regular Expression


Source Code :
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Email ID Validation Using JavaScript Regular Expression.</title>
<script language="javascript">
functionValidateEmailID(txtEmailID) {
varfilter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if(txtEmailID.value == "") {
txtEmailID.style.border = "";
returntrue;
}
elseif (filter.test(txtEmailID.value)) {
txtEmailID.style.border = "";
returntrue;
}
else{
txtEmailID.style.borderColor = "red";
returnfalse;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
Enter Email ID :
<input type="text" onkeyup="ValidateEmailID(this);" />
</div>
</form>
</body>
</html>

Comments

Popular posts from this blog

SharePoint 2013 Keyword Query (KQL) Content Class Property Restrictions

Hide Save button in New and Edit form in SharePoint 2013 list

Filtering the Sharepoint List Taxonomy Column using Rest API