Show only weekend in jQuery datepicker plugin [clo

2019-09-18 06:22发布

问题:

I would like the user can only select Saturdays and Sundays in my jQuery datepicker. What should I add to my datepicker script?

回答1:

$(function()
   {
   $('#txtDate1').datepicker({ beforeShowDay:
     function(dt)
     {
        return [dt.getDay() == 0 || dt.getDay() == 6, ""];
     }
   });
 });