gpt4 book ai didi

Jquery 模态对话框禁用表单元素

转载 作者:行者123 更新时间:2023-12-01 01:29:57 25 4
gpt4 key购买 nike

当我将 jQuery 对话框设置为 model=true 时,它​​会禁用对话框内的表单元素,并且我无法使用它们,只能使用按钮。我见过一些示例,其中对话框的内容在对话框启动脚本中声明,然后注入(inject)。但这对我来说太庞大了,我希望能够在 DIV 中创建我的标记,并将其转换为对话框。

有人能给我解决办法吗?

我的代码:


<form id="form1" runat="server">
<div class="dlg" id="msgDlg">
Name: <input type="text" />
<br />
<input type="button" class="button" value="OK" onclick="$('#msgDlg').dialog('close');" />
</div>
<script>
function InitMessageDialog(dialogId) {
$(function () {
jQuery("#" + dialogId).dialog({
autoOpen: false,
modal: false,
width: 450,
height: 300,
draggable: true,
resizable: true,
zIndex: 99999,
overlay: { backgroundColor: "#000", opacity: 0.5 },
open: function (type, data) {
$(this).parent().appendTo('#form');
}
});
})
}
function GoDialog() {
var msgDlg = $('#msgDlg').dialog('open');
}
InitMessageDialog('msgDlg');
</script>
<input type="button" class="button" value="go dialog" onclick="GoDialog()" />
</form>

最佳答案

表单的 z-index 很可能是问题所在。尝试将其设置为“自动”:

#my_dialog_form {
z-index: auto;
}

关于Jquery 模态对话框禁用表单元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2819213/

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