jQuery UI DatePicker - 禁用除每个月的第一天和第 15 天之外的所有日子 [英] jQuery UI DatePicker - Disable all days except first and 15th day of each month
本文介绍了jQuery UI DatePicker - 禁用除每个月的第一天和第 15 天之外的所有日子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在这个日期选择器上禁用除每个月的 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.
推荐答案
这应该可以解决问题:
$(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 - 禁用除每个月的第一天和第 15 天之外的所有日子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文