title: Check if an input with class is empty in a form
body: <p>I wrote a code to validate a form on client-side. Since I binded all the error messages <code>on('input', function())</code> now the last case to take in consideration is when the user didn't even hit a required input leaving it empty.</p>
  
  <p>If all the inputs in the form were required I could have used something like</p>
  
  <pre><code>$('#subButton').on('click', function(e) {
      if (!$('#formName').val()) {
          e.preventDefault();
          alert("Fill all the required fields");
  });
  </code></pre>
  
  <p>But since in my form there are required inputs (with <code>class="req"</code>) and non required inputs, I would like to know if there's a method to perform the check <strong>only</strong> on the <code>.req</code> inputs.
  Something like:</p>
  
  <pre><code>$('#subButton').on('click', function(e) {
      if (!$('#formName.req').val()) {
          e.preventDefault();
          alert("Fill all the required fields");
      }
  });
  </code></pre>
  
  <p>In other words I would like to perform the identical check which the up-to-date browsers do if the HTML <code>required</code> option is specified, just to be sure that, if the browser is a bit old and doesn't "read" the <code>required</code> option, jQuery prevents the form to be sent.</p>