我目前安装了pickadate.js。我试图禁用除3之外的所有日子。
我使用onOpen事件来阻止日子,但无论我采用哪种方式,
我唯一可以做的就是阻止所有的日子,使用disable:true,当我尝试明确应用允许的天数时,它会阻止它们。
关于如何做到这一点的任何想法非常感谢
$('input.datepicker').pickadate({
today : '',
clear : 'Clear',
format : 'dd/mm/yyyy',
clear: 'Clear selection',
labelMonthNext: 'Go to the next month',
labelMonthPrev: 'Go to the previous month',
labelMonthSelect: 'Pick a month from the dropdown',
labelYearSelect: 'Pick a year from the dropdown',
editable : false,
// disable the other days in the calendar except this one. 1 - 7 are the way days are dealt with
onOpen : function(){
var picker = this ;
var current = picker.get('id')
var allowed_days = $('#' + current).attr('data-disabled-days');
disabled_days = JSON.parse("[" + allowed_days + "]");
picker.set('disable',disabled_days);
}
});