title: jQuery Validate same name in inputs
body: <p>This form has inputs with the same name but similar (incremental) ids.</p>
  
  <p>The form should validate if there is a name on person, the age must be mandatory..</p>
  
  <p>Now only the first input is mandatory.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    &lt;form id="people"&gt;
          &lt;div class="section"&gt;
              &lt;input id="person1" name="person" class="person" type="text" placeholder="First Name" /&gt;
              &lt;input id="age1" name="age" class="age" type="text" placeholder="Age" /&gt;
          &lt;/div&gt;
          &lt;div class="section"&gt;
              &lt;input id="person2" name="person" class="person" type="text" placeholder="First Name" /&gt;
              &lt;input id="age2" name="age" class="age" type="text" placeholder="Age" /&gt;
          &lt;/div&gt;
          &lt;div class="section"&gt;
              &lt;input id="person3" name="person" class="person" type="text" placeholder="First Name" /&gt;
              &lt;input id="age3" name="age" class="age" type="text" placeholder="Age" /&gt;
          &lt;/div&gt;
          ...
          &lt;input type="submit" id="submit" name="submit" value="Add" /&gt;
      &lt;/form&gt;
      &lt;script type="text/javascript"&gt;
          $(function(){
              $('#people').validate();
              $('#submit').click(function(){
                  $('[id^="person"]').each(function(){
                      if ($(this).val().length&gt;0){
                          //alert($(this).val());
                          //alert($(this).parent().find('.age').val());
                          $(this).rules('add', {
                              required: true,
                              minlength: 2,
                              messages: {
                                  required: "Specify the person name",
                                  minlength: "Minimum of 2 characters"
                              }
                          });
                          $(this).parent().find('.age').rules('add', {
                              required: true,
                              number: true,
                              messages: {
                                  required: "Must have an age",
                                  number: "Specify a valid age"
                              }
                          });
                      }
                  });
              });
          });
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>