JQuery 对话框关闭事件
$("#termSheetPrinted").dialog({
autoOpen: false,
resizable: true,
height: $(window).height() - 50,
width: $(window).width() - 50,
position: 'center',
title: 'Term Sheet',
beforeClose: function(event, ui) { $("#termSheetPrinted").html(''); },
modal: true,
buttons: {
"Print": function () {
$("#termSheetPrinted").jqprint();
},
"Cancel": function () {
$("#termSheetPrinted").html('');
$(this).dialog("close");
}
}
});
因此,当我单击“取消”时,我可以再次生成对话框,并且一切看起来都很好。如果我单击右上角的“X”并再次生成它,它会加倍,与上次相比没有被清除。
我尝试添加 beforeClose
事件来清除 HTML,但它似乎不起作用。
如何才能从“取消”和点击“X”中正确清除并关闭它?
$("#termSheetPrinted").dialog({
autoOpen: false,
resizable: true,
height: $(window).height() - 50,
width: $(window).width() - 50,
position: 'center',
title: 'Term Sheet',
beforeClose: function(event, ui) { $("#termSheetPrinted").html(''); },
modal: true,
buttons: {
"Print": function () {
$("#termSheetPrinted").jqprint();
},
"Cancel": function () {
$("#termSheetPrinted").html('');
$(this).dialog("close");
}
}
});
So, when I click 'Cancel', I can generate the dialog right over again and everything looks fine. If I click the 'X' in the upper right corner and generate it again, it doubles up, having not been cleared from the last time.
I tried adding the beforeClose
event to clear the HTML, however it doesn't seem to be working.
How can I get it to clear and close properly from both 'Cancel', and hitting the 'X'?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我将其绑定到
close
,似乎可以工作。但这不应该是双向的吗?
Seems to work if I bind it to
close
instead.Shouldn't this work both ways though?