JQuery dialog freezing on close

喜你入骨 提交于 2019-12-11 01:19:10

问题


$("#termSheetPrinted").dialog({
            autoOpen: false,
            resizable: true,
            height: 800,
            width: 950,
            position: 'center',
            title: 'Term Sheet',
            close: function(event, ui) { 
                $(this).dialog("close");
            },
            modal: true,
            buttons: {
                "Print": function () {
                    $("#termSheetPrinted").jqprint();
                },
                "Cancel": function () {
                    $("#termSheetPrinted").html('');
                    $(this).dialog("close");
                }
            }
        });

When I click the 'x' in the upper right hand corner, firefox freezes, crashes, and nothing happens.

Do I define the close function correctly?


回答1:


you have infinite recursion on close. try this code to see it.

 close: function(event, ui) { alert("close is called");

            $(this).dialog("close");
        },

You should have only this

 close: function(event, ui) { 

            },



回答2:


To add to Vivek's answer (which resolved an issue I was having) I noticed that this only happens when the FireBug console is active. I hope that helps someone else who comes upon this problem. Prior versions of Firefox didn't seem to crash with this code.



来源:https://stackoverflow.com/questions/5082024/jquery-dialog-freezing-on-close

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