gpt4 book ai didi

JavaScript 启用调度程序

转载 作者:行者123 更新时间:2023-11-28 08:01:00 25 4
gpt4 key购买 nike

我都,我有这个代码

<select id = 'jack'>
<option id = 'test1' >test1</option>
<option id = 'test2' >test2</option>
</select>

<input id="calendar" type="text" disabled="disabled"/>

这是 JavaScript

function enableEnd() {
end.attr('disabled', !this.value.length).datepicker('option', 'minDate', this.value);
}

var end = $('#calendar').datepicker();

$('#jack').datepicker({
onSelect: enableEnd
}).bind('input', enableEnd);

当我从菜单中选择 test1 时,我会确保计划处于事件状态,而如果我选择 test2,我希望保持禁用状态

最佳答案

如果我理解你的问题,那么你正在寻找这个。

var calendar = $("#calendar").datepicker("option", "disabled", true);

$("#jack").on('change', function () {
if($(this).val() == 'test1') {
calendar.datepicker( "option", "disabled", false);
} else {
calendar.datepicker( "option", "disabled", true);
}
});

关于JavaScript 启用调度程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25385357/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com