Gab
Gab

Reputation: 531

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/

Upvotes: 7

Views: 12714

Answers (1)

techfoobar
techfoobar

Reputation: 66663

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

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

Check Demo

Upvotes: 10

Related Questions