问题
$("#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