Validation part of jquery Learning notes

Source: Internet
Author: User

1.valid () and Rules ()
Valid () Method: Checks if the form or some elements are valid, the return value is Boolean, all return true by checking the rule, and the Falserules () method is returned as long as there is a check rule that does not pass: Gets the validation rules for the form element ("add", rules) : Adds a validation rule to the form element, returning an added check rule such as: $ ("#username"). Rules ("Add", {email:true,maxlength:10}); Rules ("Remove", rules) : Deletes the form element validation rule, returning the deleted check rule, not the deleted one. such as: $ ("#username"). Rules ("Remove", "email maxlength");
2.validator objects
The Validate method returns the Validator object, Validator the object as follows: 1, Validator.form (): Verifies that the form is valid, returns TRUE/FALSE;2, validator.element (Element) : Verifies that an element is valid, returns True/false, where element is a selector such as: Validator.element ("#username") 3, Validator.resetform (): Restores the form to its original state before verification, Clears the displayed validation error message 4, validator.showerrors (Errors): Displays a specific error message for an element such as: Validator.showerrors ({username: "xxxxxx", Passworld: "XXXXX"}), the new error message immediately displays 5, Validator.numberofinvailds (): Returns the number of elements that are not valid (that is, not validated) (is to be triggered after click Verification, the number of elements that are not valid for the first time is 0)

Validation part of jquery Learning notes

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.