-
-
Save giiska/d9c2123a7c6e83ab46e0 to your computer and use it in GitHub Desktop.
jquery.validate: accordion show when form in it is invalid by config `invalidHandler`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$form.validate({ | |
ignore: '.ignore', | |
rules: rules, | |
messages: messages, | |
invalidHandler: function(event, validator) { | |
// console.log(event, validator); | |
var errorEl = validator.findLastActive() || validator.errorList.length && validator.errorList[0].element; | |
if(errorEl) | |
$(errorEl).closest('.accordion-body').collapse('show'); | |
}, | |
submitHandler: function(form) { | |
_submitForm(form); | |
return false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment