title: To disable a send button if fields empty by jQuery
body: <p><strong>How can you disable the send -button if there is one or more input -fields empty?</strong></p>
  
  <p><strong>My attempt in pseudo-code</strong></p>
  
  <pre><code>if ( $("input:empty") ) {
      $("input:disabled") 
  }
  else 
    // enable the ask_question -button
  </code></pre>
  
  <p>I have been reading these articles without finding a right solution</p>
  
  <ol>
  <li><a href="http://docs.jquery.com/Selectors/empty" rel="nofollow noreferrer">Official docs about empty</a>: this is like not relevant because it looks for all input -fields</li>
  <li><a href="https://stackoverflow.com/questions/882406/jquery-disable-button-not-submit-until-field-validates-validation-plugin">a thread about disabled -feature in jQuery</a>: this seems to be relevant</li>
  <li><a href="https://stackoverflow.com/questions/635240/selecting-all-empty-text-fields-in-jquery">to be able to test jQuery Firefox/terminal</a>: to get a testing environment would help me most</li>
  </ol>
  
  <p>I use at the moment the following code. 
  It contains one bug about the character <code>;</code>, but I cannot find it.</p>
  
  <h1>#1</h1>
  
  <pre><code>$(document).ready(function(){
      $("#ask_form").validate(){
          rules: {
              username {
                  required: true,
                  minlenghth: 2
              },
              email: {
                  required: true;
                  minlength: 6
              },
              password {
                  required: true,                                                                                                                                    
                  minlength: 6
              }
          } 
      });
  }
  </code></pre>
  
  <h1>#2 Meder's code</h1>
  
  <p>I slighhtly modified Meder's code. It disables the <code>send</code> -button permanently so it has a bug too.</p>
  
  <pre><code>$(document).ready(function(){
      var inputs = $('input', '#ask_form'), empty = false;
      // can also use :input but it will grab textarea/select elements and you need to check for those..
  
      inputs.each(function() {
          if ( $(this).val() == '' ) {
              empty = true;
              return;
          }
      });
  
      if ( empty ) {
          $('.ask_question').attr('disabled', 'disabled'); // or true I believe.
      }
  });
  </code></pre>