title: How to loop through multiple div with same class and set a different input field value from select in jQuery
body: <p>The problem is I have multiple divs with the same class, and inside those divs are an input field and 3 select fields. New divs are created at the push of a button with the same class, input and select.</p>
  
  <p>I want it so that when I change each select option fields the value of the input is updated for the current div it is in.</p>
  
  <pre><code>&lt;div class="date-dropdowns"&gt;
      &lt;input type="hidden" id="acf-field_5a7cc784294a1-0-field_5a7cc66693348" name="acf[field_5a7cc784294a1][0][field_5a7cc66693348]" required="required" value="01/02/2015"&gt;
      &lt;select class="day" name="date_[day]"&gt;
          &lt;option value=""&gt;Day&lt;/option&gt;
          &lt;option value="01"&gt;1st&lt;/option&gt;
          &lt;option value="02"&gt;2nd&lt;/option&gt;
          &lt;option value="03"&gt;3rd&lt;/option&gt;
          &lt;option value="04"&gt;4th&lt;/option&gt;
          &lt;option value="05"&gt;5th&lt;/option&gt;
      &lt;/select&gt;
      &lt;select class="month" name="date_[month]"&gt;
          &lt;option value=""&gt;Month&lt;/option&gt;
          &lt;option value="01"&gt;January&lt;/option&gt;
          &lt;option value="02"&gt;February&lt;/option&gt;
          &lt;option value="03"&gt;March&lt;/option&gt;
  
      &lt;/select&gt;
      &lt;select class="year" name="date_[year]"&gt;
          &lt;option value=""&gt;Year&lt;/option&gt;
          &lt;option value="2018"&gt;2018&lt;/option&gt;
          &lt;option value="2017"&gt;2017&lt;/option&gt;
          &lt;option value="2016"&gt;2016&lt;/option&gt;
          &lt;option value="2015"&gt;2015&lt;/option&gt;
          &lt;option value="2014"&gt;2014&lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I wrote the code below but only the first block works</p>
  
  <pre><code>$('div[data-name="date_of_birth"] input').each(function(index, elem) { 
      $(".day,.month,.year").change(function(){
          var val = $(elem).val();
          $('div[data-name="date_of_birth"] input').val(val);
      });
  });
  </code></pre>