jQuery模态对话框禁用表单元素 [英] Jquery Modal Dialog disables form elements
本文介绍了jQuery模态对话框禁用表单元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我将jQuery对话框设置为model = true时,它将禁用对话框中的表单元素,并且仅按钮可以使用它们. 我看过一些示例,其中对话框的内容在对话框启动脚本中声明,然后注入.但这对我来说实在是太庞大了,我希望能够在DIV中创建我的标记,然后将其变成一个对话框.
When I set my jQuery dialog to model=true, it disables my form elements inside the dialog and I cannot use them, only the buttons. I have seen examples where the contents of the dialog is declared in the dialog initiation script and then injected. but that is just to bulky for me, I want to be able to create my markup inside the DIV which I turn into a dialog.
有人给我解决方案吗?
我的代码:
<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很可能是问题所在.尝试将其设置为自动":
The z-index of the form is most likely the problem. Try setting it to "auto":
#my_dialog_form {
z-index: auto;
}
这篇关于jQuery模态对话框禁用表单元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文