I have From Date
and To Date
jQuery datepicker
controls and if I change From Date
, then To Date
should automatically be 180 days
from From Date
Below code is not firing the onSelect
event even if this looks so simple...
$("#txtFrom").datepicker({
minDate: 0,
onSelect: function (dateStr) {
var newDate = $(this).datepicker('getDate');
if (newDate) {
newDate.setDate(newDate.getDate() + 180);
}
$('#txtTo').datepicker('setDate', newDate).datepicker('option', 'minDate', newDate);
}
});
Also, I require onChange
event to be fired...
Any help would be greatly appreciated.