Dialog - destroy on close

Dialog - destroy on close


Hi,
I want to emulate a custom alert message using the dialog. Here's an
example:
$('<div>jQuery is great!</div>').dialog({
title: "I love jQuery",
modal : true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
'Okay': function() {
$(this).dialog('close').remove();
return false;
}
}
});
}
One thing I realized though, is that if the user clicks the X rather
than a button, the dialog gets closed but not removed. Is there a way
to not show the X or to destroy the dialog when it is closed via the
X? I guess I could add a close function to the options; but I wasn't
sure exactly what the function would look like to get the dialog
element. Also, I was wondering if there was a better way to do this
that I am not seeing.
Thanks,
Dave