Jump to content

Email Id Validation Script


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...