<input id="datepicker">
var picker = new Pikaday({
disableDayFn: function(date){
// Disable Monday
return date.getDay() === 1;
},
field: document.getElementById('datepicker')
});
目前上面的代码有一天禁用,我希望它禁用两天。请帮我解决一下
示例:JsFiddle:http://jsfiddle.net/jpwk4wpv/
答案 0 :(得分:1)
在.startAnimation
内使用$('.not-clicked').click(function(e) {
$(this).removeClass('not-clicked');
$(this).addClass('clicked');
if ($('.not-clicked').length == 0) {
var nextBtn = document.getElementsByName("commit")[0];
nextBtn.removeAttribute('disabled');
}
});
(或)操作,如下所示: -
||
答案 1 :(得分:1)
你必须使用||禁用两天像这样:
var picker = new Pikaday({
disableDayFn: function(date){
// Disable Monday
return date.getDay() === 1 || date.getDay() === 2;
},
field: document.getElementById('datepicker')
});
答案 2 :(得分:0)
或者...通过禁用天数的数组传递
// disabled days array
var disabledDays = [1,2]
//your disabledDayFn
disableDayFn: function(date){
return disabledDays.includes(date.getDay)
}