You cannot disable a button in a click event; because if the form is still invalid when you click the button, you cannot click it again. You can disable it only after the form has successfully passed validation.
Use the submitHandler plugin submitHandler for this, since it is launched by clicking the button only when the form has passed validation.
<script> $(document).ready(function() { $("#signupForm").validate({ wrapper: "div", rules: { email: { required: true, email: true }, password: { required: true, minlength: 5 } }, messages: { email: "Use una cuenta de correo válida", password: { required: "Ingrese su contraseña", minlength: "La contraseña al menos debe tener 5 caracteres" } }, submitHandler: function(form) { </script>
NOTES:
$().ready(function() {... not recommended according to jQuery documentation . Instead, use $(document).ready(function() {... or $(function() {...
You do not need the embedded HTML required attribute if you have already declared the required rule in .validate() .
Your submitHandler within setDefaults() been broken. The string signupForm.submit() will not do anything, because signupForm is an undefined variable. Define submitHandler inside .validate() and use the form argument provided by the developer.
DEMO: http://jsfiddle.net/6foLxzmc/13/
source share