Dinuka Thilanga
Dinuka Thilanga

Reputation: 4330

Disable specific day in Jquery date picker

I want to disable all days with out Monday and Friday in Jquery date picker. How to do it?

Upvotes: 1

Views: 1056

Answers (1)

William Niu
William Niu

Reputation: 15853

What threw you off might be the hidden $.datepicker.noWeekends method, which is really what you're after. So, what you really need to do is:

$("#datepicker").datepicker({
    beforeShowDay: function (date) {
        var day = date.getDay();
        return [(day == 1 || day == 5), ''];
    }
});

See example: http://jsfiddle.net/william/fsEpP/2/

Upvotes: 3

Related Questions