jQuery datepicker 即时设置选定日期 [英] jQuery datepicker set selected date, on the fly

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

问题描述

如何动态更改 jquery 日期选择器的选定日期?我说过创建了一个内联日期选择器.然后过了一段时间,我想在那里反映一个不同的日期,而不是从头开始重新创建日期选择器.

How can I change the selected date of jquery Date picker dynamically on the fly? I have say created a inline date picker. Then after some time, I want to reflect a different date there without recreating the datepicker from the scratch.

我尝试了 setDate 方法,但没有奏效,而且 doc 中没有太多文档

I tried the setDate method, but did not work, and there is not much documentation in the doc.

还有另一个(扩展?)插件这里,但我想使用jquery.ui.all.js 附带的插件.

There is another (extended?) plugin here, but I want to use the plugin which is shipped with jquery.ui.all.js.

推荐答案

您使用的是哪个版本的 jQuery-UI?我已经使用 1.6r6、1.7 和 1.7.1 测试了以下内容,并且可以正常工作:

What version of jQuery-UI are you using? I've tested the following with 1.6r6, 1.7 and 1.7.1 and it works:

//Set DatePicker to October 3, 2008
$('#dateselector').datepicker("setDate", new Date(2008,9,03) );

这篇关于jQuery datepicker 即时设置选定日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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