问题
I am using a jquery ui datepicker. I want to add some validation so it only allows people to choose Saturdays instead of any date.
I could validate after the fact but thought it would be slicker to have the datepicker do the upfront validation by only enabling Saturday dates.
回答1:
$("#test").datepicker(
{
beforeShowDay: function(date){
if(date.getDay() == 6){
return [true];
} else {
return [false];
}
}
}
);
来源:https://stackoverflow.com/questions/4604435/is-there-anyway-to-have-a-jquery-ui-date-picker-only-allow-saturdays