views:

27

answers:

2

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,""]}
+3  A: 

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.

Nick Craver
awesome... thanks
Tom
+1  A: 

try this

beforeShowDay: function(date)
{ return [(date.getDay() == 1 || date.getDay() == 4), ""]; }
JapanPro