1: Custom form submission
Set Submithandler to customize form submission actions
$ (". Selector"). Validate ({
Submithandler:function (form) {alert ("Validate Pass");}
});
If you need to submit a form, you can call
Form.submit (); or $ (form). Ajaxsubmit ();
2: Debug mode
Set Debug to True, the form will not be submitted, only checked, easy to debug
$ (". Selector"). Validate ({
Debug:true
})
3: Set default value for Validate
Use SetDefaults to set default values for validate, such as all form validation by default in debug mode
$.validator.setdefaults ({
Debug:true
})
4: Some elements do not validate
Setting the Ignore property can omit certain elements from being validated
$ (". Selector"). Validate ({
Ignore: "Ignore"
})
5: Time to verify
Jquery.validate can be conveniently set when the verification action is triggered
OnSubmit: Whether to validate at commit
$ (". Selector"). Validate ({
Onsubmit:false
})
Onfocusout: Validation when losing focus (except Checkboxes/radio)
$ (". Selector"). Validate ({
Onfocusout:false
})
OnKeyUp: Validating at KeyUp
$ (". Selector"). Validate ({
Onkeyup:false
})
OnClick: Verified when checkboxes, radio clicked.
$ (". Selector"). Validate ({
Onclick:false
})
6: Overriding validation rules and validation tips
Overriding the validation hints for max
$.validator.messages.max = Jquery.format ("Your totals Musn ' t exceed {0}!");
Overriding the Equal method
$.validator.methods.equal = function (value, element, param) {
return value = = param;
};
7:focusinvalid whether to focus on the last action or the most recent error
$ (". Selector"). Validate ({
Focusinvalid:false
})
8:focuscleanup
If the property is set to true, the control obtains the focus, removing the wrong class definition, hiding the error message, and avoiding focusinvalid.
$ (". Selector"). Validate ({
Focuscleanup:true
})
9:meta
Set meta to encapsulate validation rules
$ (". Selector"). Validate ({
Meta: "Validate",
})