title: When a user selects startDate and endDate, I want start date to be displayed in other text box
body: <p>I want to select the startDate from this field:
  
  @Html.EditorFor(model =&gt; model.TimePeriod.StartDate, new { htmlAttributes = new { @class = &quot;form-control datepicker&quot;, @id=&quot;StartDate&quot;,@onchange=&quot;addDates()&quot; } })
  @Html.ValidationMessageFor(model =&gt; model.TimePeriod.StartDate, &quot;&quot;, new { @class = &quot;text-danger&quot; })
  </p>
  <p>Here I want to autopopulate that start date here</p>
  <pre><code>&lt;td&gt;
                      @Html.EditorFor(model =&gt; model.DailyRegister.Date, new { htmlAttributes = new { @class = &quot;form-control&quot;, required = &quot;required&quot;, @id = &quot;date1&quot; } })
                      @Html.ValidationMessageFor(model =&gt; model.DailyRegister.Date, &quot;&quot;, new { @class = &quot;text-danger&quot; })
                      &lt;script&gt;
                              function addDates() {
                              document.getElementById(&quot;date1&quot;).value = document.getElementById(&quot;StartDate&quot;);
                          }
                      &lt;/script&gt;
                  &lt;/td&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/DpTMX.png" rel="nofollow noreferrer">Running above code gives this result</a></p>