jQuery UI DatePicker – 禁用除每月第1天和第15天之外的所有日期
除了每个月的第1天和第15天,我想禁用此日期选择器的所有日期。 我引用了这个已回答的问题,但我只能返回一个日期。 我是javascript的新手。 jQuery UI DatePicker – 禁用除月末之外的所有日期
任何帮助都会很棒,谢谢。
这应该是诀窍:
$(function(){ $("input").datepicker( { beforeShowDay: function (date) { if (date.getDate() == 15 || date.getDate() == 1) { return [true, '']; } return [false, '']; } }); });
查看下面的链接以获取一个工作示例!
似乎这样可行
$('.selector').datepicker({ beforeShowDay: function (date) { //getDate() returns the day (0-31) if (date.getDate() == 1 || date.getDate() == 15) { return [true, '']; } return [false, '']; } });