Proper way to 'remove' a dialog that calls removeData correctly?
Hi,
If I use something like $('#SomeDialog').dialog(....);
And then do a dialogClose(), the result is that the dialog is hidden
but still in the DOM.
I would like to remove it from the DOM, but am unsure of the safe way
to do this.
You can't use $('#SomeDialog').remove(), because this leaves the
generated ui-dialog parent divs in the DOM.
You can't use $('#SomeDialog).parents('.ui-dialog').remove() because
if I understand it correctly this won't call remove() on child
elements, (and removeData is called in remove()) .
This means the data attached to #SomeDialog during dialogInit will be
left around.
So I'm ending up doing:
var parent = $('#SomeDialog').parents('.ui-dialog');
$('#SomeDialog).remove();
parent.remove();
Is this right way to do it, or am I misunderstanding how remove works?
Thanks for any pointers,
Ted