Search code examples
jqueryvalidation

Disable/enable entire form's submit with jquery


When my form doesn't validate, I want to disable the form's submit function. I can do this by disabling the submit button, but this would leave the enter key unchecked.
I can set the .submit(return false); but then I can't re-enable it again later.

Any suggestions?


Solution

  • just a simplification of Pim's (edited to pull up James contribution):

    
    $('#form').submit(formValidated);