title: Check if at least one input field is filled in jQuery
body: <p>I have a jQuery script that checks if at least one input field contains text but it doesn't check my select option. Can anybody please help me to implement it? </p>
  
  <p>The script:</p>
  
  <pre><code>$(function(){
      $("#myform").submit(function(){
  
          var valid=0;
          $(this).find('input[type=text]').each(function(){
              if($(this).val() != "") valid+=1;
          });
  
          if(valid){
              alert(valid + " inputs have been filled");
              return true;
          }
          else {
              alert("error: you must fill in at least one field");
              return false;
          }
      });
  });
  </code></pre>
  
  <p>and the HTML for testing this:</p>
  
  <pre><code>&lt;form action="/echo/html" id="myform" method="post"&gt;
  &lt;input type="text"&gt;&lt;br&gt;
  &lt;input type="text"&gt;&lt;br&gt;
  &lt;input type="text"&gt;&lt;br&gt;
  
  &lt;select name="something" id="something" type="text"&gt;
  &lt;option value=""&gt;&lt;/option&gt;
  &lt;option value="one"&gt;Option one&lt;/option&gt;
  &lt;option value="two"&gt;Option two&lt;/option&gt;
  &lt;option value="three"&gt;Option three&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;input type="submit"/&gt;
  &lt;/form&gt;​
  </code></pre>