Validation library in JavaScript
11:17 23 Nov 2010

Is there any validation library in JavaScript? I'm looking for something small, simple and basic.

Example 1

var email = "steve@jobs.com";

if ( validate(email, "email") ) {

  // Success

}

Example 2

var email = "steve@jobs.com";

if ( validate(email, {
  "length": [0, 12],
  "characters": ["a", "b", "c", "d", "e", ...],
}) ) {

  // Success

}

Thank you.

javascript