gpt4 book ai didi

javascript - jquery UI 模式不会导致回发

转载 作者:行者123 更新时间:2023-11-28 04:59:28 24 4
gpt4 key购买 nike

我有一个 jquery UI 模式,它在单击复选框时打开,并在单击“确定”按钮后导致回发,但它不起作用。我已经尝试了所有解决方案。请帮助。Asp.net 按钮位于表单标记内。

$("#dialog").dialog({
modal: true,
autoOpen: false,
title: "Other-Legend",
width: 300,
open: function (type, data) {
$(this).parent().appendTo("form");
},
buttons: {
Ok: function () {
$("[id*=btnConfirm]").click();
},
Close: function () {
$(this).dialog('close');
}
}
});

jQuery('input[type="checkbox"]').click(function () {
var parentClass = jQuery(this).parent('td').attr('class');
var checked = jQuery(this);
jQuery('.' + parentClass.substring(0, parentClass.length - 8) + ' input[type="checkbox"]').each(function (i, e) {
jQuery(this).prop('checked', false);
})
jQuery(checked).prop('checked', true);
if (parentClass.indexOf("mdclass") >= 0) {
$('#dialog').dialog('open'); }
});

<asp:Button ID="btnConfirm" runat="server" Text="Button" style="display:none" OnClick ="Button1_Click" />

最佳答案

您可以尝试添加 jQuery UI v1.10 或更高版本的语法,将模式 DIV 附加到表单。

$("#dialog").dialog({
modal: true,
autoOpen: false,
title: "Other-Legend",
width: 300,
appendTo: "form",
buttons: {
Ok: function () {
$("[id*=btnConfirm]").click();
},
Close: function () {
$(this).dialog('close');
}
}
});

关于javascript - jquery UI 模式不会导致回发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42264285/

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