Hi.
I have simple 2 datepickers, i am trying to change the min. date value of second datepicker based on the first one but its not working. My code is following:
<form method="post" action="search.php">
<input required type="date" id="strdate" name="strdate" />
<input required type="date" id="enddate" name="enddate" />
<input type="submit" name="btnSearch" value="Check" />
</form>
<script>
$('#strdate').datepicker({
onSelect: function(dateStr) {
var min = $(this).datepicker('getDate') || new Date();
min.setDate(min.getDate()+2); //add two days
$('#enddate').datepicker('option', {minDate: min});
}
});
</script>
What’s wrong with it ?
Thanks.