title: Validate dynamically generated input fields as well as static fields
body: <pre><code>$(function () {
      var scntDiv = $('#p_scents');
  
      var i = $('#p_scents p').size() + 1;
  
      $('#addScnt').live('click', function () {
  
          $('.buttonaddrate').hide(); //first time hide add button
          $('&lt;p style="float:left;"&gt;&lt;span style="float:left;"&gt;For&lt;/span&gt;\
                          &lt;input type="text" id="people' + i + '" name="people[]" value="" placeholder="People" class=" one columns people" /&gt;\
                           &lt;input type="text" id="rate' + i + '" name="rate[]" value="" style="margin-right:4px; margin-left:3px;" placeholder="Rate" class=" one columns  rate" /&gt;\
                      &lt;span style="float:none; margin-left:8px;" class="removerate" id="removethis"&gt;&lt;a class="button large_button delete"  id="remScnt"&gt;&lt;span&gt;&lt;/span&gt;rate&lt;/a&gt;&lt;/span&gt;&lt;span class="buttonaddrate"&gt;&lt;a class="button large_button add" id="addScnt"&gt;&lt;span&gt;&lt;/span&gt;rate&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;').appendTo(scntDiv);
  
          i++;
          return false;
  
      });
      //remove button code
      $('#remScnt').live('click', function () {
  
          if (i &gt; 2) {
              $(this).parents('p').remove();
              $('.buttonaddrate').hide();
              i--;
          }
          //this code append add button to previous remove button
          if (i = $('#p_scents p').size() - 1) {
  
              $('&lt;p style="float:left;"&gt; &lt;span class="buttonaddrate"&gt;&lt;a class="button large_button add dd" id="addScnt"&gt;&lt;span&gt;&lt;/span&gt;rate&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;').appendTo(scntDiv);
  
          }
  
          return false;
      });
  
  });
  </code></pre>