jQuery datepicker以防止过去的日期

编程入门 行业动态 更新时间:2024-10-28 08:24:55
本文介绍了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以防止过去的日期

本文发布于:2023-10-26 21:38:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1531421.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日期   以防止   jQuery   datepicker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!