jQuery datepicker设置选择的日期,即时 [英] jQuery datepicker set selected date, on the fly
问题描述
如何在动态上动态更改jquery Date选择器的选择日期?
我说的是创建一个内联日期选择器。
然后在一段时间后,我想反映一个不同的日期,而不从头开始重新创建datepicker。
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方法,但没有工作,文档中没有太多的文档。
I tried the setDate method, but did not work, and there is not much documentation in the doc.
另外还有一个(扩展的)插件 here ,但我想使用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屋!