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:
- 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,
- 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:
You need to make a call to .dialog( "destroy" )
to remove it completely
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"