相关疑难解决方法(0)

如何在jQuery UI Datepicker日历上清除/重置所选日期?

如何重置日期选择器日历值?..最小和最大日期限制?

问题是当我清除日期(通过删除文本框值)时,仍然会应用先前的日期限制.

我一直在整理文档,没有任何东西作为解决方案跳出来.我也无法找到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);
    });
});??
Run Code Online (Sandbox Code Playgroud)

_.clearDate()是DatePicker对象的私有方法.你不会在jQuery UI的网站上的公共API中找到它,但它就像一个魅力.

jquery jquery-ui jquery-ui-datepicker

80
推荐指数
6
解决办法
22万
查看次数

标签 统计

jquery ×1

jquery-ui ×1

jquery-ui-datepicker ×1