Javascript jQuery Datepicker与minDate&;maxDate
目前,我正在使用以下代码来设置日期选择器功能-Javascript jQuery Datepicker与minDate&;maxDate,javascript,jquery,datepicker,Javascript,Jquery,Datepicker,目前,我正在使用以下代码来设置日期选择器功能- $("#datepicker").click(function() { $(this).datepicker().datepicker( "show" ); }); 但如果我从参数中删除“show”。它不起作用,我想添加更多的参数,如minDate,maxDate 请帮助我如何使用“show”参数进行操作 提前谢谢 您可以将其作为选项传递,如 $("#datepicker").click(function () { $(t
$("#datepicker").click(function() {
$(this).datepicker().datepicker( "show" );
});
但如果我从参数中删除“show”。它不起作用,我想添加更多的参数,如minDate,maxDate
请帮助我如何使用“show”参数进行操作
提前谢谢 您可以将其作为选项传递,如
$("#datepicker").click(function () {
$(this).datepicker({
maxDate: yourMaxDate,
minDate: yourMinDate
}).datepicker("show");
});
我不知道您为什么要使用单击处理程序来初始化日期选择器。。。。你可以这么做
$("#datepicker").datepicker({
maxDate: yourMaxDate,
minDate: yourMinDate
});
演示:
在插件初始化之后,如果要更新选项的值,可以使用
您可以使用
选项进行更改
$("#datepicker").click(function() {
$(this).datepicker('option', 'minValue', new Date(startDate));
$(this).datepicker('option', 'maxValue', new Date(endDate));
}
or...
$("#datepicker").click(function() {
$(this).datepicker('option', { minValue: new Date(startDate),
maxValue: new Date(endDate) });
}
$("#datepicker").click(function() {
$(this).datepicker('option', 'minValue', new Date(startDate));
$(this).datepicker('option', 'maxValue', new Date(endDate));
}
or...
$("#datepicker").click(function() {
$(this).datepicker('option', { minValue: new Date(startDate),
maxValue: new Date(endDate) });
}