我正在尝试jQuery UI datepicker选择日期范围(禁用导致结束日期早于开始日期的选项),如演示here。但它没有用。这是我的代码
$( "#fromDiv" ).datepicker({
defaultDate: '-1y',
yearRange: "-5:+0",
altFormat: 'dd/mm/yy',
altField: '#from',
onClose: function( selectedDate ) {
$( "#toDiv" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#toDiv" ).datepicker({
yearRange: '-5:+0',
altFormat: 'dd/mm/yy',
altField: '#to',
onClose: function( selectedDate ) {
$( "#fromDiv" ).datepicker( "option", "maxDate", selectedDate );
}
});
帮助