how to check unique email id client side code example
Example 1: Email Validation in JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Email validation</title>
<script type="text/javascript">
function email_funnction() {
var email = document.emailform.email.value;
if(email.indexOf('@')<=0){
document.getElementById('errormsg').innerHTML="Invalid your Email Address";
return false;
}
if ((email.charAt(email.length-4)!='.') && (email.charAt(email.length-3)!='.')) {
document.getElementById('errormsg').innerHTML="Invalid your Email Address";
return false;
}
}
</script>
</head>
<body>
<h1>Email Validation in javascript</h1>
<span id="errormsg"></span>
<form name="emailform" onsubmit="return email_funnction()">
<label>Email</label>
<input type="text" name="email" value="">
<input type="submit" name="" value="Submit">
</form>
</body>
</html>
Example 2: form validation for email in js
<script>
function validateform(){
var name=document.myform.name.value;
var password=document.myform.password.value;
if (name==null || name==""){
alert("Name can't be blank");
return false;
}else if(password.length<6){
alert("Password must be at least 6 characters long.");
return false;
}
}