Dambo Dambo - 3 months ago 29x
jQuery Question

How to make certain months unselectable with datepicker?

I would like to make certain months unselectable. So for example the user should be able to navigate different years, but 'November' will always be greyed-out (or even better, completely excluded from the widget).

Right now, I have tried something like this:



<input type="text" id="datepicker" />


$(document).ready(function() {
beforeShowMonth: function (date) {
if (date.getMonth() == 10) {
return [false];


The jQueryUI datepicker does not have a beforeShowMonth property, only beforeShowDay. You also need to return [true] from that function if the date is valid. With that in mind, try this:

    beforeShowDay: function(date) {
        return [date.getMonth() != 10];

Updated fiddle