Jquery. validate Introduction 2 _ jquery

Source: Internet
Author: User
JQuery. validate. jsAPI description Plugin methodsName Type
Validate (options) Returns: Validator
Verify the selected FORM
Valid () Returns: Boolean
Check whether verification is passed
Rules () Returns: Options
Verification rules for returned Elements
Rules ("add", rules) Returns: Options
Add verification rules
Rules ("remove", rules) Returns: Options
Delete verification rules
RemoveAttrs (attributes) Returns: Options
Delete special attributes and return them
Custom selectors
Name Type
: Blank Returns: Array
Filter with no value
: Filled Returns: Array
Filter with values
: Unchecked Returns: Array
Filter of unselected Elements
Utilities
Name Type
JQuery. format (template, argument, argumentN...) Returns: String
Replace {n} in the template with parameters }.
The Validatorvalidate method returns A Validator object, which has many methods, allowing you to use the content that triggers the verification program or change the form.
Below is a list of commonly used.
Form () Returns: Boolean
Whether the result of form verification is successful or not
Element (element) Returns: Boolean
Verify whether a single element is successful or failed
ResetForm () Returns: undefined
Restore the previously verified FORM to the original status before verification
ShowErrors (errors) Returns: undefined
Display specific error messages
Built-in Validation methods
Name Type
SetDefaults (defaults) Returns: undefined
Change default settings
AddMethod (name, method, message) Returns: undefined
Add a new verification method. The name, a JAVASCRIPT method, and a default information must be included.
AddClassRules (name, rules) Returns: undefined
Added the combined verification type.
AddClassRules (rules) Returns: undefined
Added the combined verification type.
Built-in Validation methodsName Type
Required () Returns: Boolean
Required verification element
Required (dependency-expression) Returns: Boolean
The required element depends on the result of the expression.
Required (dependency-callback) Returns: Boolean
The required element depends on the result of the callback function.
Remote (url) Returns: Boolean
Request Remote verification. A url is usually a remote call method.
Minlength (length) Returns: Boolean
Set minimum length
Maxlength (length) Returns: Boolean
Set the maximum length
Rangelength (range) Returns: Boolean
Set a length range of [min, max]
Min (value) Returns: Boolean
Set the minimum value.
Max (value) Returns: Boolean
Set the maximum value.
Range (range) Returns: Boolean
Set the value range
Email () Returns: Boolean
Verify email format
Url () Returns: Boolean
Verify the connection format
Date () Returns: Boolean
Verification Date Format (similar to the format of 30/30/2008. if the date is not verified, only the format is verified)
DateISO () Returns: Boolean
Date Format of ISO type developed
DateDE () Returns: Boolean
Verify the German Date Format (292.164.1994 or 1.1.2006)
Number () Returns: Boolean
Verify the decimal number (including decimal digits)
NumberDE () Returns: Boolean
Makes the element require a decimal number with german format.
Digits () Returns: Boolean
Verification integer
Creditcard () Returns: Boolean
Verify credit card number
Accept (extension) Returns: Boolean
Verify strings with the same suffix
Failed to (other) Returns: Boolean
Verify that the content of the two input boxes is the same
For other APIs, refer to the custom section in the next chapter.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.