如何在jQuery datepicker上禁用过期日期?我寻找选项,但似乎没有找到任何表示禁用过去日期的功能。
更新:感谢yall快速回复。我试过没有运气。天数依然不像我预期的那样变灰,仍然接受选定的过去日期。
我尝试过:
$('#datepicker') .datepicker({minDate:'0'});不行。
我尝试这样:
$('#datepicker')datepicker({minDate:new Date()});仍然不起作用。
它显示日历部件很好。它不会灰色或阻止过去几天的输入。我以前尝试过minDate和maxDate,没有运气,所以我认为它不能是他们。
解决方案尝试这样:
$(#datepicker)。datepicker({minDate:0});从 0 中删除引号。 p>
How do I disable past dates on jQuery datepicker? I looked for options but don't seem to find anything that indicates the ability to disable past dates.
UPDATE: Thanks yall for the quick response. I tried that with no luck. Days were still not grayed out as I expected and still accept the selected past date.
I tried this:
$('#datepicker').datepicker({ minDate: '0' });Doesn't work.
I tried this:
$('#datepicker').datepicker({ minDate: new Date() });Still doesn't work either.
It displays the calendar widget just fine. It just won't gray out or prevent input of past days. I've attempted the minDate and maxDate in the past with no luck so I figured it must not be them.
解决方案Try this:
$("#datepicker").datepicker({ minDate: 0 });Remove the quotes from 0.
更多推荐
jQuery datepicker以防止过去的日期
发布评论