jQuery UI Datepicker - setDate not working

前提是你 提交于 2019-12-30 08:13:08

问题


I know this question has been asked on SO before, but I can't figure out what I'm missing. Here is a simple Fiddle.

The jquery:

var myDate = new Date(1978,2,11) 
$('#datepicker').datepicker('setDate', myDate);

回答1:


You have to initialize the datepicker first:

    $('#datepicker').datepicker();

When you pass setDate, you are calling a method which assumes the datepicker has already been initialized on that object.

http://jsfiddle.net/tbYPf/4/



来源:https://stackoverflow.com/questions/11962747/jquery-ui-datepicker-setdate-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!