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 "unspecified" 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
here is my code
<div class="form-group">
<label for="birth-date" >BIRTH DATE</label>
<input type="date" name="bd" id="bd" value="" >
<label for="date_range" >AGE RANGE</label>
<select class="form-control" name="date_range" id="date_range">
<option></option>
<?php
foreach ($dr as $row) {
echo '<option value="' . $row->id . '>' . $row->name. '</option>';
}
?>
</select>
</div>
Best regards