我正在使用 jQuery 打开一个对话框。当我尝试关闭对话框时,它抛出 js 错误
"Error: too much recursion Source File:
http://localhost:8080/testProject/scripts/jquery-1.4.4.js Line: 648"
对话功能如下:
jQuery(function() {
jQuery( "#purchaseOrderDevice-form" ).dialog({
bgiframe:true,
autoOpen: false,
height: 550,
width: 870,
modal: true,
resizable : true,
close: function() {
jQuery( "#purchaseOrderDevice-form" ).dialog( "close" );
}
});
jQuery( "#purchaseOrderDevice" ).button().click(function() {
jQuery( "#purchaseOrderDevice-form" ).dialog( "open" );
});
});
最佳答案
jQuery( "#purchaseOrderDevice-form" ).dialog({
bgiframe:true,
autoOpen: false,
height: 550,
width: 870,
modal: true,
resizable : true,
close: function() {
},
buttons: {
'Close': function () {
$(this).dialog("close");
}
}
});
这就是应该如何完成的 - 不要在每次关闭时都告诉它关闭,否则会出现循环。
关于jquery - JS错误: too much recursion in jquery-1. 4.4.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5389579/