Reputation: 1606
I want to enable all monday of every month and disable past days. this is the code i'm using :
$(document).ready(function() {
$('.datepicker').datepicker({
autoclose: true,
startDate: new Date()
});
});
and this is jsfiddle. this website has exactly what i want example
Upvotes: 2
Views: 4601
Reputation: 9362
Just use daysOfWeekDisabled. 0-6 = Days of week
$(document).ready(function() {
$('.datepicker').datepicker({
autoclose: true,
startDate: new Date(),
daysOfWeekDisabled: "0,2,3,4,5,6"
});
});
Upvotes: 5
Reputation: 13806
You can use the beforeShowDay method of the datepicker to restrict the available dates - it can also be used to restrict to certain weekdays.
Working example which only allows mondays in the future:
$(document).ready(function() {
$('.datepicker').datepicker({
autoclose: true,
startDate: new Date(),
beforeShowDay:
function(dt)
{
return dt.getDay() == 1;
}
});
});
Also updated your fiddle: http://jsfiddle.net/hous9y5L/275/
Upvotes: 0