Super Easy Email Validation AS2

I needed a quick and easy way to check for the basics of an email address.

Does it contain “@” and “.” symbols.

This is by no meals a foolproof method, so don’t use it for anything big, but if you want to just do a quick test then here you go:

var email:String = "[email protected]"; if (email.indexOf("@")!=-1 && email.indexOf(".")!=-1) trace("false"); else trace ("true");
Code language: JavaScript (javascript)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments