Reputation: 219
I want the user to be able to see all days from within the month, but to be able to select only the mondays of every week. I know that this is done on "beforeshowday" or something like that, but I don't know how. Any help, please ?
Upvotes: 2
Views: 2936
Reputation: 57105
You can use the beforeShowDate event
of the datepicker combined with Date.getDay()
to do what you want, like this:
var arr = [1, 2, 3, 4, 5, 6]
$("#datepicker").datepicker({
beforeShowDay: function (date) {
var day = date.getDay();
return [(arr.indexOf(day) == -1)];
}
});
$("#datepicker").datepicker({
beforeShowDay: function (date) {
var day = date.getDay();
return [(day == 0)];
}
});
Upvotes: 4