
how to validate the email id ?

<html>
<script>
function validate(){
var e=document.getElementById('email').value;
var regExpObj = /(\d\d\d)-\d\d\d\d\d\d\d\d/;
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var e = document.getElementById('email').value;
if(reg.test(e) == false) {
alert('Invalid Email Address');
document.getElementById('email').value="";
return false;
}
}
</script>
<form id="form" method="post" onsubmit="javascript:return validate();">
<table>
<tr><td>Email </td><td><input type="text" id="email" ></td></tr>
<tr><td></td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</html>
For more information, go through the following link:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.