如何使用初始化为禁用的 JQuery-ui 启用复选框无线电

问题描述 投票:0回答:0

我有一个复选框,当页面上发生其他操作时,我需要启用和禁用该复选框。 使用 jquery-ui 更改了复选框,因此它看起来很漂亮。 这是伪代码:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<script>
$(document).ready(function(){
    $("#openchest").checkboxradio();
    $("#enablebutton").click(function(){
        $("#openchest").prop("disabled", false); // Doesnt work
        $("#openchest").checkboxradio("enable"); // Also doesn't work
    });
});
</script>
<button id="enablebutton">enable checkbox</button>
<label for="openchest"><input type="checkbox" id="openchest" disabled="disabled" value="1" />

我需要更改什么才能使按钮重新启用由 jquery-ui 初始化的复选框?

javascript jquery jquery-ui
© www.soinside.com 2019 - 2024. All rights reserved.