Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery datepicker beforeShowDay after initializing

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/

like image 629
Gab Avatar asked Jul 27 '13 12:07

Gab


1 Answers

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

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

Check Demo

like image 132
techfoobar Avatar answered Oct 31 '22 06:10

techfoobar