jQuery enable Submit button only if all form fields has class before form submit

I would actually come at this from a different angle.

You have a fixed number of inputs per form, right? Just match the number of inputs with the ‘is-valid’ class to the total number of inputs on the page.

if $('form1 input.is-valid').length == 12 {
 # enable the submit button
};

if $('form2 input.is-valid').length == 4 {
 # enable the submit button
};

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top