Jump to content

Email Id Validation Script


subha rr

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...