is there anyway to have a jquery UI date picker only allow saturdays?

心不动则不痛 提交于 2019-12-23 09:37:01

问题


I am using a jquery ui datepicker. I want to add some validation so it only allows people to choose Saturdays instead of any date.

I could validate after the fact but thought it would be slicker to have the datepicker do the upfront validation by only enabling Saturday dates.


回答1:


$("#test").datepicker(
    {
        beforeShowDay: function(date){
          if(date.getDay() == 6){
                return [true];
            } else {
                return [false];
            }
        }
    }
);


来源:https://stackoverflow.com/questions/4604435/is-there-anyway-to-have-a-jquery-ui-date-picker-only-allow-saturdays

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!