I have the following code which only allows users to select Mondays from jquery datepicker.
I want to adapt this to be able to select mondays and thursdays.
Any ideas?
beforeShowDay: function(date){ return [date.getDay() == 1,""]}
I have the following code which only allows users to select Mondays from jquery datepicker.
I want to adapt this to be able to select mondays and thursdays.
Any ideas?
beforeShowDay: function(date){ return [date.getDay() == 1,""]}
You can add an or (||
) in there, like this:
beforeShowDay: function(date){
var day = date.getDay();
return [day == 1 || day == 4,""];
}
This only incurs the cost of .getDay()
once per date shown, not that it's an expensive operation anyway, but no reason not to be efficient.
try this
beforeShowDay: function(date)
{ return [(date.getDay() == 1 || date.getDay() == 4), ""]; }