title: Automatic date selection onselect another date textbox with "add a row" functionality
body: <p>I have been trying to display a date for another date field with date selected of current field. It's working perfectly only for the first row. Below is the code:</p>
  
  <p>Javascript:</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  //&lt;![CDATA[
  $(function(){
  
  $('.one').datepicker({
  onSelect: function(date){
    var date2 = $('.one').datepicker('getDate');
    date2.setDate(date2.getDate()+1);
    $('.two').datepicker('setDate', date2);
  }
  })
  $('.two').datepicker({})
  
  });
  $(document).ready(function() {
  var currentItem = 1;
  $(".datepicker").datepicker();
  $('#addnew').click(function(){
  currentItem++;
  $('#items').val(currentItem);
  var strToAdd = '&lt;tr&gt;&lt;td style=""&gt;&lt;input type="text" name="task'+currentItem+'" id="task'+currentItem+'" value="" /&gt;&lt;/td&gt;&lt;td style=""&gt;&lt;input type="text" name="Description'+currentItem+'" id="Description'+currentItem+'" value="" /&gt;&lt;/td&gt;&lt;td style="width: 160px;"&gt;&lt;input type="text" class="one datepicker" name="Internal_Deadline'+currentItem+'" id="Internal_Deadline'+currentItem+'" /&gt;&lt;/td&gt;&lt;td style=""&gt;&lt;input type="text" class="two datepicker" name="Client_Deadline'+currentItem+'" id="Client_Deadline'+currentItem+'" /&gt;&lt;/td&gt;&lt;td style=""&gt;&lt;input type="text" class="datepicker" name="Actual_Deadline'+currentItem+'" id="Actual_Deadline'+currentItem+'" /&gt;&lt;/td&gt;&lt;td style="width:83px;"&gt;&lt;/td&gt;&lt;/tr&gt;';
   $('#data').append(strToAdd);
     $(".datepicker").datepicker(); 
  
    });
    });
  
    //]]&gt;
  
    &lt;/script&gt;
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;TABLE id="data" class="dd" style=""&gt;
      &lt;TR&gt;
      &lt;td style=""&gt;&lt;input type="text" name="task1" id="task1" value="" /&gt;&lt;/td&gt;&lt;td style=""&gt;&lt;input type="text" name="Description1" id="Description1" value="" /&gt;&lt;/td&gt;&lt;td style="width: 160px;"&gt;&lt;input type="text" class="one datepicker" name="Internal_Deadline1" id="Internal_Deadline1" value="" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="text" class="two datepicker" name="Client_Deadline1" id="Client_Deadline1" value="" /&gt;&lt;/td&gt;&lt;td style=""&gt;&lt;input type="text" class="datepicker" name="Actual_Deadline1" id="Actual_Deadline1" value="" /&gt;             &lt;/td&gt;&lt;td style="width: 83px;"&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;input type="hidden" id="items" name="items" value="1" /&gt; 
      &lt;/TABLE&gt;
  </code></pre>