Properly cleaning up a JQuery Dialog box to prevent memory leaks

One of the cool things about JQuery is you can declare an invisible DIV with a “display:none” style and then use that DIV as the content for a popup dialog box in your application. I have been working on a pretty dynamic web application that is pretty much all JavaScript and buttons come and go based on the users actions. This can present a problem with regard to memory consumption. Each time you callĀ $(“#dialog”).dialog() jQuery creates a set of DIV’s in the base of the HTML.

Continue reading