title: Removing empty Input Elements from a form
body: <p>I have a simple form that goes on to create all the form and validation requirements for codeigniter.  What I want to do is filter out any empty inputs prior to serialization so that I do not create form inputs and form validation set rules. I am at a loss as to how to go about this. Where I have the alert in the Jquery is where I want to remove any empty inputs(again prior to serialization). <strong>At this point what I am using does not detect empty form fields.</strong> Without the detection code the entire system works fine. Here is what I am using</p>
  
  <pre><code>    &lt;h1&gt;Field Name&lt;/h1&gt;
      &lt;form action="Form.php" onsubmit="return false;" id="form" method="post"&gt;
      &lt;input type="text" name="v1" id="v1" /&gt; 
      &lt;input type="text" name="v2" id="v2" /&gt; 
      &lt;input type="text" name="v3" id="v3" /&gt; 
      &lt;input type="text" name="v4" id="v4" /&gt; 
      &lt;input type="text" name="v5" id="v5" /&gt; 
      &lt;input type="text" name="v6" id="v6" /&gt; 
  
  &lt;input type="submit" name="send" id="send" value="Send" /&gt;
          &lt;/form&gt;
  &lt;hr /&gt;
  &lt;script&gt;
  $(function(){
  $('#send').click(function(){ 
  ---------------------------------------   
      $(":input").each(function() {
      if($(this).val() === "")
      alert("Empty Fields!!"); //using alert just to see if empty fields are detected.
      return false;
  });
  -----------------------------------------
  var data = $('#form').serialize();
      $.ajax({
          type: "POST",
          data: data,
          url: "Form.php",
          success: function(msg){
               if(msg){
                  $('#display').html(msg).show();
               }else{
                  $('#display').text("&lt;p&gt;nothing came back&lt;/p&gt;");
               }
          }       
      });
  return false;    
  });
  });
  </code></pre>
  
  <p>I am simply trying to avoid printing out empty form fields</p>
  
  <pre><code>&lt;p&gt;
  &lt;label for=""&gt;&lt;/label&gt; &lt;br /&gt;
  &lt;input type="text" name="" id="" /&gt; &lt;br /&gt;
  &lt;label class="error" id=""&gt; This field is required&lt;/label&gt; &lt;br /&gt;
  &lt;p/&gt;
  </code></pre>
  
  <p>Thank you for your time</p>