jQuery UI DatePicker - 禁用除了每个月的第一天和第十五天之外的所有天 [英] jQuery UI DatePicker - Disable all days except first and 15th day of each month
本文介绍了jQuery UI DatePicker - 禁用除了每个月的第一天和第十五天之外的所有天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
除了每个月的1号和15号之外,我想禁用此日期戳的所有日子。我参考了这个回答的问题,但我只能返回一个约会。我是javascript的新手 jQuery UI DatePicker - 禁用除上一天以外的所有日子的月份
I want to disable all days on this datepicker except the 1st and 15th of every month. I referenced this answered question, but I am only able to return one date. I'm a novice in javascript. jQuery UI DatePicker - Disable all days except last day of month
任何帮助都会很棒,谢谢。
Any help would be great, thank you.
推荐答案
这应该是诀窍:
This should do the trick:
$(function(){
$("input").datepicker(
{
beforeShowDay: function (date) {
if (date.getDate() == 15 || date.getDate() == 1) {
return [true, ''];
}
return [false, ''];
}
});
});
请查看下面的链接,了解一个工作示例!
Check out the link below for a working example!
这篇关于jQuery UI DatePicker - 禁用除了每个月的第一天和第十五天之外的所有天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文