title: Set startDate on dynamic datepicker
body: <p>I have dynamically created html table using jquery which contains 3rows with input textboxes.The fields of the table are </p>
  
  <pre><code>SlNo        Fee          ST       TotalAmt       DueDate
  </code></pre>
  
  <p>On the first row <code>startDate</code> of <code>DueDate</code> should be the current date.</p>
  
  <p>On the second row <code>startDate</code> of <code>DueDate</code> should be previously(date of first row) selected date.</p>
  
  <p>On the third row <code>startDate</code> of <code>DueDate</code> should be previously(date of second row) selected date</p>
  
  <p><strong>Jquery for dynamically created table</strong></p>
  
  <pre><code> var $tbody = $("#tblPaymentDetails tbody");
      $($tbody).html('');
  
      for (var i = 0; i &lt; 3; i++) {
  
          var slno = parseInt(i + 1);
  
          var $row = $('&lt;tr/&gt;');
          $row.append(' &lt;td class="slno"&gt;' + slno + '&lt;/td&gt;');
  
          $row.append(' &lt;td&gt;&lt;input name="StudentReceipt[' + i + '].Fee" type="text" class="form-control"  /&gt;&lt;/td&gt;');
          $row.append(' &lt;td&gt;&lt;input name="StudentReceipt[' + i + '].ST" type="text" class="form-control "  /&gt;&lt;/td&gt;');
          $row.append(' &lt;td&gt;&lt;input name="StudentReceipt[' + i + '].Total" type="text" class="form-control "  /&gt; &lt;/td&gt;');
          $row.append(' &lt;td&gt;&lt;input id="txtDueDate'+i+'" name="StudentReceipt[' + i + '].DueDate" type="text" class="form-control duedate"  /&gt;&lt;/td&gt;');
  
          $tbody.append($row);
  
      }
  </code></pre>
  
  <p><strong>Jquery dynamic datepicker</strong></p>
  
  <pre><code>$(document).on('focus', ".dueDate", function () {
      var currentDatepickerId = $(this).attr("id");
      var currMinDate="";
      //For first datepicker
      if (currentDatepickerId == "txtDueDate0") {            
          currMinDate=new Date()
      }
      else {
          //gets the last selected date from the hiddenfield
          var selectedDate = $("#selectedDate").val().split("/");
          currMinDate = new Date(selectedDate[2], selectedDate[0] - 1, selectedDate[1]);
      }     
  
      $(this).datepicker({
          autoclose: true,
          startDate: currMinDate           
      }).on("change", function (evt) {
          var currValue = $(this).val();
          //stores the currently selected value to hiddenfield
          $("#selectedDate").val(currValue);
      });
  
  });
  </code></pre>
  
  <p>This is what I have tried.I am getting the desired result on the first attempt.But on resetting the <code>textbox value</code> of the <code>first row</code> makes the <code>start date</code> of the <code>second row</code> to the <code>newDate</code> </p>