我有以下选择器:
$('.datetimepicker').datetimepicker({
format: 'LT',
locale: 'PT-BR',
icons: {
up: "fa fa-chevron-up",
down: "fa fa-chevron-down",
time: "far fa-clock",
},
enabledHours: permittedHours(),
stepping: 15,
});
但是我想在输入值更改的情况下,在重新设置enabledHours时调用其他aux函数。
我将其链接起来,可以成功弹出警报:
$('.datetimepicker').datetimepicker({
format: 'LT',
locale: 'PT-BR',
icons: {
up: "fa fa-chevron-up",
down: "fa fa-chevron-down",
time: "far fa-clock",
},
enabledHours: permittedHours(),
stepping: 15,
})
.on('dp.change', function (e) {
alert(e.date._i)
});
但是,如果我尝试处理enabledHours,它将无法正常工作。在这种情况下,如何将新值传递给enabledHours?
答案 0 :(得分:-1)
on('dp.change', function (e) {
$('.datetimepicker').data("DateTimePicker").enabledHours(your_function(e.date.format('yourformat')));
});