title: Check if all form fields have inputs jQuery
body: <p>I have a form on my page, I want to disable the submit button via jQuery until all the form fields have a value. I also have server-side validation, but I would rather use some client-side validation to ease the strain on my server. I currently hold all the elements of my form in an array, I then loop over each element and check if any are empty. I also need to recall this function everytime a user enters data into the form, to check if all the inputs have been filled. This seems to put a huge strain on my browser and crashes the page, below is code.</p>
  
  <pre><code>let inputArray = [
              $('.registration-form #inputEmail'),
              $('.registration-form #inputForename'),
              $('.registration-form #inputSurname'),
              $('.registration-form #inputJobTitle'),
              $('.registration-form #inputJobFunction'),
              $('.registration-form #inputCompanyName'),
              $('.registration-form #inputCompanySize')
          ];
  
          let $registerButton = $('.create-account-button');
  
          function checkFields() {
              inputArray.forEach(function (input) {
                  if (!$(input).val()) {
                      $registerButton.prop('disabled', true);
                  } else {
                      $registerButton.prop('disabled', false);
                  }
                  input.on('input', checkFields);
              });
          }
  </code></pre>