I am using Jquery date picker and I have the following code where when user selects a date, the field below is populated with date +1
$('#dt2').datepicker({
dateFormat: "dd-M-yy"
});
$("#dt1").datepicker(
{dateFormat: "dd-M-yy",
minDate: 0,
onSelect: function(date){
var date2 = $('#dt1').datepicker('getDate');
date2.setDate(date2.getDate()+1);
$('#dt2').datepicker('setDate', date2);
I would like to restrict dates in dt2
field which should not be below the date in dt1
field. E.g. If date selected in dt1
is 01-May-2013
, then user is allowed to pick date after 01-May-2013
, not less than 02-May-2013
How can I restrict date picking in date field 2?