title: Dropdown menu that depends on the date field using JQUERY
body: <p>I'm working on a project using JQUERY, but I'm facing a difficult situation, I usually know how to make a dropdown menu depend to another, but now i need a dropdown menu that contains the age ranges that's depend on the date typed in birth-date field, I would like that when I type in the birth-date field, the drop-down menu should automatically select the age range, but if the date field is empty it must select the &quot;unspecified&quot; option whose ID equals 4 which appears in the DATE_RANGE table, Please help me to solve this riddle, welcome to any suggestion.
  If I made a mistake in the question asked, please explain to me what should I do, any help will be appreciated</p>
  <p>here is my code</p>
  <pre><code>&lt;div class=&quot;form-group&quot;&gt;
  
      &lt;label for=&quot;birth-date&quot; &gt;BIRTH DATE&lt;/label&gt;
      &lt;input type=&quot;date&quot; name=&quot;bd&quot; id=&quot;bd&quot; value=&quot;&quot;  &gt;
  
      &lt;label for=&quot;date_range&quot; &gt;AGE RANGE&lt;/label&gt;
      &lt;select class=&quot;form-control&quot; name=&quot;date_range&quot; id=&quot;date_range&quot;&gt;
          &lt;option&gt;&lt;/option&gt;
          &lt;?php
          foreach ($dr as $row) {
          echo '&lt;option value=&quot;' . $row-&gt;id . '&gt;' . $row-&gt;name. '&lt;/option&gt;';
          }
          ?&gt;
      &lt;/select&gt;
      
  &lt;/div&gt;
  </code></pre>
  <p>Best regards</p>