Very handy code to validate input on the client in the browser using JavaScript and Regular expressions
See the working demo below.
This is pretty much the standard JavaScript you'll paste into your page script block - or in a .js file if you prefer.
function isEmail(elm) {
if (elm.value == '') {
alert("fill in email"); return false;
}
var ePat = /\b[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b/;
if (ePat.test(elm.value) == false) {
alert(elm.value + " is NOT a valid email");
return false;
}else{
alert(elm.value + " IS A VALID email");
return false;
}
}
Edit as necessary.
body{
font-size:2em;
font-weight:bold;
}
input{
font-size:50px;
}
button{
font-size:50px;
}
A few lines of JQuery is all you need to validate email addresses with javascript and regex