Reputation: 825
I am following a tutorial about jQuery UI, and, although it works, I am trying to find the explanation in the jquery UI Datepicker documentation but I can't find what I am looking for.
To disable weekends, the tutorial creates a function:
function onBeforeShowDay(theDate) {
//day 0 is sunday, 6 is saturday
if(theDate.getDay() == 0 || theDate.getDay() == 6) {
return [false, "weekend", "Weekends disabled"];
}
return [true, ""];
}
And then it gets called on beforeShowDay:
$("#datepick1").datepicker({
firstDay: 1,
showButtonPanel: true,
currentText: "Today",
closeText: "close",
beforeShowDay: onBeforeShowDay,
numberOfMonths: 1,
constrainInput: true
});
The return value is an array with true/false, a css class you might want (it can be empty), and the title you want for those weekends. Where am I suppose to find this?
Thank you
Upvotes: 0
Views: 991
Reputation: 5176
According to the API (http://api.jqueryui.com/datepicker/#option-beforeShowDay)
beforeShowDay
A function that takes a date as a parameter and must return an array with:
The function is called for each day in the datepicker before it is displayed.
Upvotes: 1