I was using the following to disable all submit buttons on a form after it has been submitted, to prevent people double clicking submit buttons, etc:
jQuery (function ($) {
$('form').bind ('submit', function () {
$(this).find ('button').attr ('disabled', 'disabled');
});
});
I am using jquery.validate, which in the event of a validation error, still fires off ‘submit’ when the form is submitted, and thus the user is left with a form with errors, and disabled submit buttons.
How can I modify the above code to detect if the form had jquery.validation errors?
You can check if the form is valid by calling
$("form").valid()