https://jqueryvalidation.org/documentation/
API Documentation
You're probably looking for
Options for the validate() method
If not, read on.
Throughout the documentation, two terms are used very often, so it's important that you know their meaning in the context of the validation plugin:
- method: A validation method implements the logic to validate an element, like an email method that checks for the right format of a text input's value. A set of standard methods is available, and it is easy to write your own.
- rule: A validation rule associates an element with a validation method, like "validate input with name "primary-mail" with methods "required" and "email".
Validator
The validate method returns a Validator object that has a few public methods that you can use to trigger validation programmatically or change the contents of the form. The validator object has more methods, but only those documented here are intended for usage.
Validator.form()
– Validates the form.Validator.element()
– Validates a single element.Validator.resetForm()
– Resets the controlled form.Validator.showErrors()
– Show the specified messages.Validator.numberOfInvalids()
– Returns the number of invalid fields.Validator.destroy()
– Destroys this instance of validator.
There are a few static methods on the validator object:
jQuery.validator.addMethod()
– Add a custom validation method.jQuery.validator.format()
– Replaces {n} placeholders with arguments.jQuery.validator.setDefaults()
– Modify default settings for validation.jQuery.validator.addClassRules()
– Add a compound class method.
List of built-in Validation methods 内置的验证方法
A set of standard validation methods is provided:
required
– Makes the element required.remote
– Requests a resource to check the element for validity.minlength
– Makes the element require a given minimum length.maxlength
– Makes the element require a given maximum length.rangelength
– Makes the element require a given value range.min
– Makes the element require a given minimum.max
– Makes the element require a given maximum.range
– Makes the element require a given value range.step
– Makes the element require a given step.email
– Makes the element require a valid emailurl
– Makes the element require a valid urldate
– Makes the element require a date.dateISO
– Makes the element require an ISO date.number
– Makes the element require a decimal number.digits
– Makes the element require digits only.equalTo
– Requires the element to be the same as another one