Disable jqueryui calendar days EXCEPT the mondays of every week
Disable jqueryui calendar days EXCEPT the mondays of every week
Let’s say you 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.
1 2 3 4 5 6 |
$("#datepicker").datepicker({ beforeShowDay: function (date) { var day = date.getDay(); return [(day == 1)]; } }); |
Here is a DEMO.
You can disable all “Sundays” by switching from “day == 1” to “day==-1” in the return clause, like this:
1 2 3 4 5 6 |
$("#datepicker").datepicker({ beforeShowDay: function (date) { var day = date.getDay(); return [(day == -1)]; } }); |
From there, you have full control over the week days.