jquery再次打开对话框后,父对话框文本框被锁定

时间:2010-12-01 02:54:02

标签: jquery-ui

我打开两次模态对话框, 第二个对话框关闭后,文本框将锁定在第一个对话框(父对话框)中 为什么?如何解决问题?我是新用户,所以我无法发布图片 任何答案将不胜感激,谢谢

HTML:

<XMP>
<input id="btnDlg" type="button" value="open dialog" />
<div id="dlg1"><%=Html.TextBox("txtName","can not edit") %><input id="btnShowDlg" type="button" value="dialog again" /></div>
<div id="dlg2"><div>the second dialog</div><%=Html.TextBox("txtName2") %></div>
</XMP>

jquery的:

$("#dlg1").dialog({
                autoOpen: false,
                height: 350,
                width: 300,
                title: "The first dialog!",
                bgiframe: true,
                modal: true,
                resizable: false,
                buttons: {
                    'Cancel': function() {
                        $(this).dialog('close');
                    },
                    'OK': function() {
                        $(this).dialog('close');
                    }
                }
            })

            $("#dlg2").dialog({
                autoOpen: false,
                height: 200,
                width: 300,
                title: "This is the second dialog!",
                bgiframe: true,
                modal: true,
                resizable: false,
                buttons: {
                    'Cancel': function() {
                        $(this).dialog('close');
                    },
                    'OK': function() {
                        $(this).dialog('close');
                    }
                }
            })            
            $("#btnDlg").click(function() {
                $("#dlg1").dialog("open");
            })

            $("#btnShowDlg").click(function() {
                $("#dlg2").dialog("open");
            })

2 个答案:

答案 0 :(得分:1)

buttons: {
                "Save": function () {
                    //validate
                    if (typeof (Page_ClientValidate) == 'function') {
                        Page_ClientValidate(newValGroup);
                    }
                    if (Page_IsValid) {
                        gettHTML(divID, PriceID);
                    }
                },
                Cancel: function () {
                    $(this).dialog("close");
                }
            },
            close: function (ev, ui) {
                $(this).dialog("destroy");
            }

        });
        $("#" + divID).dialog('open');
        return false;

答案 1 :(得分:0)

是的,您可以尝试制作模态:假。它会工作..

让我知道..

由于