I have two datepickers 'startDate' and 'targetDate'.I want to set the minDate of the 'targetDate' as the value of 'startDate'.The following code is not working.ie,the minDate of 'targetDate' is not set.
$("#startDate").datepicker({ changeMonth : true, changeYear : true, dateFormat : "dd-M-yy", minDate : 0, showMonthAfterYear : true, onClose : function() { $(this).toggleClass('ui-state-focus'); } }); $("#targetDate").datepicker({ changeMonth : true, changeYear : true, dateFormat : "dd-M-yy", minDate : new Date($("#startDate").val()), showMonthAfterYear : true, onClose : function() { $(this).toggleClass('ui-state-focus'); } });
minDateof the targetDate datepicker during theonCloseevent of the startDate datepicker.