You need to destroy the dialog as well, like so:
$j(this).dialog('destroy').remove();
This will return back to the pre-dialog state (removing the extra divs). If
you only call .remove(), it just removes that element (which is the content
of the dialog, not the dialog itself)
- Richard
On Tue, Sep 16, 2008 at 2:16 PM, Jeremy <[EMAIL PROTECTED]> wrote:
>
> I noticed that even when I do the code below and I open and close my
> dialog, I still have a bunch of divs sitting around in my dom. Of
> course they are hidden but it seems weird that destroying and removing
> doesn't get rid of these.
>
> var myDialog = $j("<div id=\"myDialog-container\"></div>").load("/
> myapp/dialogcontent.jsp");
> myDialog.dialog({
> close: function(e, ui) {
> $j(this).remove();
> }
> });
>
> I'm also very new to jQuery (spent years with Prototype) so any
> suggestions are more then welcome on how I can improve my code. To
> get rid of those extra div's I did the following code, but I'm not
> sure if this is the correct way. What do you think?
>
> var myDialog = $j("<div id=\"myDialog-container\"></div>").load("/
> myapp/dialogcontent.jsp");
> myDialog.dialog({
> close: function(e, ui) {
> $j(this).remove();
> $j(".ui-dialog").remove(); // REMOVE EXTRA DIVS
> }
> });
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---