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