我想禁用jQuery对话框按钮时,复选框被选中。在下面的代码中,它是Update the counter
复选框。是否有可能实现同样的目标?
let additionalValue = "ABC12345";
console.log("Login next suggested value " + additionalValue + "");
let buttons = {};
// Use bracket notation to set a dynamic property key for the object
buttons["Login next suggested value " + additionalValue] = function() {
$(this).dialog("close");
};
buttons["Login case number of your choice"] = function() {
$(this).dialog("close");
};
buttons["Cancel button"] = function() {
$(this).dialog("close");
};
$("#dialog-confirm").dialog({
resizable: false,
height: "auto",
width: 400,
modal: true,
buttons: buttons
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>jQuery UI Dialog - Modal confirmation</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<div id="dialog-confirm" title="Select your choice!?">
<p><span>The next sequential value for the Case number is 1001 .\n\nClick Yes to use the next sequential value or Cancel to proceed with yours!</span></p>
<p><input type="checkbox" id="update_counter_checkbox" name="update_counter_checkbox" />Update the counter</p>
</div>
1条答案
按热度按时间mpbci0fu1#
我希望这对你有用。