Jump to content

Email Id Validation Script


subha rr
 Share

Recommended Posts

The normal technique for that kind of validation involves regular expressions. But there's nothing wrong with what you're trying to do.Here's a nifty way of adding a method to the Array object. It does what you want, and you'll find 1001 uses for it besides.

Array.prototype.contains = function (val) {	for (var sub in this) {		if (this[sub] == val) {			return true;		}	}	return false;}// USE IT LIKE THISvar arr = ['Sam','Abdul','Grete'];var person = "Abdul";if (arr.contains(person) ) {	alert ("YES");}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...