Jquery Modal Dialog disables form elements

≯℡__Kan透↙ 提交于 2019-12-01 22:14:09

问题


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.

Anyone got a solution for me?

My Code:


<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>


回答1:


The z-index of the form is most likely the problem. Try setting it to "auto":

#my_dialog_form {
    z-index: auto;
}


来源:https://stackoverflow.com/questions/2819213/jquery-modal-dialog-disables-form-elements

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!