Skip to content Skip to sidebar Skip to footer

Remove A Dialog Is Not Removing Its Inner Contents

I have made a dialog and a UI Tab in that dialog. In that tab i am showing some contents as a table. When i close the dialog by remove() method it closes the dialog but when i reop

Solution 1:

You're creating your divs once, and then reusing those same instances repeatedly. Your remove call just removes that div (along with all of its contents) from the DOM tree -- you're not doing anything that will clear the div's contents.

You should probably either:

  1. Create a new set of divs each time you show the dialog -- i.e., re-run all of the above code each time you want to show the dialog, rather than doing some of it once up-front. That way, you're starting with a clean slate each time. Or,
  2. Clear the contents of one or more of the divs before you start adding new stuff to it, by calling empty().

Option #1 would probably be cleaner and easier to maintain in most cases.

Solution 2:

Solution 3:

You need to call destroy on the window (Which then places your content back as it was) and then empty/delete the content using something like $("#main").remove().

Post a Comment for "Remove A Dialog Is Not Removing Its Inner Contents"