$("#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’?
Seems to work if I bind it to
closeinstead.Shouldn’t this work both ways though?