I am using Bootstrap DatePicker. I want to Validate From Date and To Date . Start Date correctly Pick todays date.I have a Problem " To Date does not Pick the start date(ie. from date value)" .How to solve it?
$(document).ready(function() {
$('#fromDate').datepicker({
startDate: new Date(),
});
$('#toDate').datepicker({
startDate: $('#fromDate').val(),
});
});
At the time you set
$('#toDate').datepicker()
, the value of$('#fromDate')
is empty.You should set default
startDate
andendDate
variables at the begining and addchangeDate
event listener to your datepickers.Eg.: