问题是,当我清除日期时(通过删除文本框值) ,以前的日期限制仍然适用。
我一直在整理 文件的资料,没有找到什么有用的解决方案。我也无法找到一个快速修复的 SO/谷歌搜索
Http://jsfiddle.net/corydanielson/tf5mh/
解决方案:
// from & to input textboxes with datepicker enabled
var dates = $("input[id$='dpFrom'], input[id$='dpTo']");
// #clearDates is a button to clear the datepickers
$('#clearDates').on('click', function(){
dates.attr('value', '');
dates.each(function(){
$.datepicker._clearDate(this);
});
});
我不知道。ClearDate ()是 DatePicker 对象的私有方法。你不会在 jQueryUI 网站上的公共 API 中找到它,但是它的工作原理非常有魅力。