How can I show errors in jQuery validation?
问题 Do we have any function which returns all the error messages while validating a form? I have tried using the defaultshowerros() function but it returns the error message for the element it is currently validating. How can I get all the error messages of the whole form? 回答1: If you store a reference to the validator, for example: var validator = $("form").validate(); You can call .errors() or .invalidElements() at any time on it, for example: var errors = validator.errors(); //get the error