Skip to content

Instantly share code, notes, and snippets.

@SamWM
Created February 20, 2012 15:48
Show Gist options
  • Select an option

  • Save SamWM/1869756 to your computer and use it in GitHub Desktop.

Select an option

Save SamWM/1869756 to your computer and use it in GitHub Desktop.
jQuery UI DatePicker - only allow Monday to be selected
$(".week").datepicker("option", {
beforeShowDay: function (date)
{
return [date.getDay() == 1, ''];
}
});
// prevent changing weeks and months
var weekOptions = { "changeMonth": false, "changeYear": false, "stepMonths": 0, beforeShowDay: function (date) {
return [date.getDay() == 1, ''];
}
};
$(function () {
$(".week").datepicker("option", weekOptions);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment