The below code is for validating email. I am getting false for inputs like,
mike@gmail.com
kid@gmail.com
stain@yahoo.com
Can someone point what mistake in the code?
function validate(){
fieldValue = document.getElementById("check").value;
pattern = new RegExp(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/);
if(pattern.test(fieldValue)){
alert("true");
} else {
alert("false");
}
}
Thanks