For Javascript email validation
Put This in code
(Form onsubmit="return validateForm()") this should be the submit value for form and then this code
<input name="email" placeholder="Email" type="text" class="textField" id="email" value=""/>
Now javascript fuction
<script type="text/javascript">
function validateForm()
{
var email = document.getElementById('email');
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email.value)) {
alert('Please provide a valid email address');
email.focus;
return false;
}
else {
return true;
}
}
</script>
Put This in code
(Form onsubmit="return validateForm()") this should be the submit value for form and then this code
<input name="email" placeholder="Email" type="text" class="textField" id="email" value=""/>
Now javascript fuction
<script type="text/javascript">
function validateForm()
{
var email = document.getElementById('email');
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email.value)) {
alert('Please provide a valid email address');
email.focus;
return false;
}
else {
return true;
}
}
</script>
No comments:
Post a Comment