jQuery datepicker以防止过去的日期 [英] jQuery datepicker to prevent past date

查看:120
本文介绍了jQuery datepicker以防止过去的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在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以防止过去的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆