title: Javascript - loop through datepickers and set date
body: <p>I don't know Javascript at all.  I have a form where there can be any number of datepicker textboxes.  When the user selects a date in the first datepicker textbox, then I want all the remaining datepicker textboxes to have that same date.</p>
  
  <p>Does this require a function?</p>
  
  <p>
  
  <p>Edit:  I tried to create a function, but I don't know javascript at all!</p>
  
  <pre><code>    function UpdateValuationDates(event) {
          $valuationDatePicker = $(event.target);
  
          var valuationDate = $valuationDatePicker.datepicker("getDate");
  
  
          if (valuationDate != null) {
              //loop through all items
  
  
              document.getElementById("dateValuationDate").Text
                      $valuationDatePicker.datepicker("setDate", valuationDate);
              $valuationDatePicker.trigger('change');
          }
      }
  </code></pre>
  
  <p>So I think this can be ignored.  I have also read that there is a datepicker on selected event:</p>
  
  <pre><code>$(".date").datepicker({
    onSelect: function(dateText) {
      display("Selected date: " + dateText + "; input's current value: " + this.value);
    }
  });
  </code></pre>
  
  <p>So I guess I need to edit this code to populate the rest of the textboxes, but how to find out at runtime how many there are?</p>
  
  <p>The HMTL has a repeater with the datepicker repeated x number of times:</p>
  
  <pre><code> &lt;abc:DatePicker runat="server" ID="dateValuationDate"
  </code></pre>