本文介绍了Jquery Modal Dialog 禁用表单元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 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 Modal Dialog 禁用表单元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 22:15