var str = $(”#email”).val();
if((str.indexOf(”.”) > 2) && (str.indexOf(”@”) > 0) && ((str.indexOf(”.”) + 1) < str.length-1)){
alert(”valid”);
}
else{
alert(”Invalid”);
}
Post your trick
validate email in javascript
One Response to “validate email in javascript”
Leave a Reply
Post A Trick !
How does "Kodetricks" work?
We at kodeplay like to share knowledge. With Kodetricks, even you can join us. All you need to do is post a programming related trick if you have one or rate a trick if you like someone else's.
Hi
wouldnt regular expressions be better for doing this too?