jquery autoselect datepicker on load

时间:2017-05-22 19:00:42

标签: jquery datepicker

我的页面有一个日历(jquery datepicker),只有一个日期可供用户选择,默认显然是用户选择日期,因为只有一个可用日期。

enter image description here

问题是:可以自动选择加载页面时的可用日期,在源中,可用日期有一个类bookable

<td class=" ui-datepicker-other-month bookable" title="This date is available" data-handler="selectDay" data-event="click" data-month="5" data-year="2017"><a class="ui-state-default ui-priority-secondary" href="#">2</a></td>

我需要隐藏此日历并自动选择日期

谢谢:)

1 个答案:

答案 0 :(得分:0)

$( ".bookable" ).datepicker( "setDate", "10/12/2012" );

您可以阅读here上的文档。基本上,上述代码会将日期设置为12/12/2012

相关问题