没有任何预定义的“默认”的jQuery Datepicker日期? [英] jQuery Datepicker without any predefined "default" date?

查看:176
本文介绍了没有任何预定义的“默认”的jQuery Datepicker日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用datepicker为在线酒店预订工具选择日期。我需要一个没有任何预定义的默认日期的选择器,让用户做到这一点。同时,我想使用minDate功能,不让我的用户过去选择一个日期。在这一刻,我解决了这个问题,一个非常不愉快的骇客的datepicker源代码 - 所以,我将无法更新它,我真的不喜欢这样的黑客。是否有理性的人方式呢?我已经杀死了几个小时在这个问题上工作,没有找到任何解决方案。

I want to use the datepicker to choose dates for an online hotel booking tool. I need to have a picker without any predefined "default" date, to let the user do it. At the same time, I want to use the minDate functionality to not let my user choose a date in the past. At this moment, I solved this problem with a very unpleasant hack of the datepicker source code - so, I won't be able to update it, and I really don't like such hacks. Is there a reasonnable, "human" way to do this? I have killed hours working on the question and did not find any working solution.

推荐答案

一旦定义和初始化了datepicker,你可以使用 .datepicker(setDate,null)清除默认日期。

Once the datepicker is defined and initialized, you can use .datepicker( "setDate" , null ) to clear out the default date.

http://api.jqueryui.com/datepicker/#method-setDate

注意 这不是与设置 defaultDate option ...

NOTE This is not the same as setting the defaultDate option...

这篇关于没有任何预定义的“默认”的jQuery Datepicker日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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