【发布时间】:2012-04-25 17:33:56
【问题描述】:
您好,我想在我的 jQuery 日期选择器中将最小日期设置为 (1999-10-25)。所以我尝试了下面的代码它不起作用。
$(function () {
$('#datepicker').datepicker({
dateFormat: 'yy-mm-dd',
showButtonPanel: true,
changeMonth: true,
changeYear: true,
showOn: "button",
buttonImage: "images/calendar.gif",
buttonImageOnly: true,
minDate: new Date(1999, 10 - 1, 25),
maxDate: '+30Y',
inline: true
});
});
如果我将最小年份更改为高于 2002 年,它将正常工作,但如果我指定最小年份小于 2002 年(如上面的示例 1999),它将只显示到 2002 年。
我正在使用jquery-1.7.1.min.js 和jquery-ui-1.8.18.custom.min.js。
【问题讨论】:
-
要在初始化后设置,使用
$('#datepicker').datepicker( "option", "minDate", new Date( 1999, 10 - 1, 25 ) )。
标签: jquery jquery-ui jquery-ui-datepicker