JQuery Modal Dialog disables form elements

When I set the jQuery dialog to model = true, it disables the form elements inside the dialog box, and I cannot use them, just the buttons. I saw examples where the contents of a dialog are declared in a script dialog initiative, and then introduced. but it’s just cumbersome for me, I want to be able to create my markup inside the DIV, into which I will turn into a dialogue.

Has anyone got a solution for me?

My code is:


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

+3
source share
1 answer

Z-form index is most likely a problem. Try setting it to "auto":

#my_dialog_form {
    z-index: auto;
}
+2
source

Source: https://habr.com/ru/post/1745111/


All Articles