Jquery datepicker beforeShowDay after initializing

回眸只為那壹抹淺笑 提交于 2020-07-05 08:01:16

问题


When I am setting beforeShowDay after initializing it doesn't work

$("#dater").datepicker();

$("#dater").datepicker({
    beforeShowDay: renderCalendarCallback
});

It will work when I will change and call beforeShowDay for first time

$("#dater").datepicker({
    beforeShowDay: renderCalendarCallback
});

$("#dater").datepicker();

How can I fix this to call beforeShowDay in first scenario too? Note that I can't remove first initialization, because it is unreachable for me. You can test this scenarios in this jsfiddle http://jsfiddle.net/b6V3W/352/


回答1:


For setting options after initialization, you need to use the option() method.

$('#dater').datepicker( "option", "beforeShowDay", renderCalendarCallback );

Check Demo



来源:https://stackoverflow.com/questions/17898008/jquery-datepicker-beforeshowday-after-initializing

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