JQuery Validation Library (Document! X Sample)
jQuery Namespace > validator type : addMethod Method
The name of the method, used to identify and referencing it, must be a valid javascript identifier
The actual method implementation, returning true if an element is valid. First argument: Current value. Second argument: Validated element. Third argument: Parameters.
The default message to display for this method. Can be a function created by jQuery.validator.format(value). When undefined, an already existing message is used (handy for localization), otherwise the field-specific messages have to be defined.
addMethod Method
Add a custom validation method. It must consist of a name (must be a legal javascript identifier), a javascript based function and a default string message.
Syntax
// Parameters
var name; // Type:  String
var method; // Type:  any
var message; // Type:  String

jQuery.validator.addMethod(name, method, message);
function addMethod( 
   name : String,
   method : any,
   message : String
) : Void;

Parameters

name
The name of the method, used to identify and referencing it, must be a valid javascript identifier
method
The actual method implementation, returning true if an element is valid. First argument: Current value. Second argument: Validated element. Third argument: Parameters.
message
The default message to display for this method. Can be a function created by jQuery.validator.format(value). When undefined, an already existing message is used (handy for localization), otherwise the field-specific messages have to be defined.
Browser Compatibility
8
5
5
See Also