tags:

views:

21

answers:

2

Please help! I have designed a dashboard that uses gadgets. One of the gadgets creates a dialog but every time that the gadget is refreshed, it creates another dialog with the same id. This dialog contains a form, so there are issues with getting and submitting the value of my inputbox since there are identical id's on my page.

What is the best way to destroy newly created dialogs and then removing that div from the DOM without affecting my initially created dialog?

A: 

Why not set a cookie that holds a value saying "hey you already have one of these things, you don't need another one", and only creating the dialog if the cookie isn't set?

hollsk
+1  A: 

add this to your dialog call:

close: function (ev, ui) {
            $(this).dialog("destroy");
            $(this).remove();

        },

this will destroy the dialog and remove the div when it's closed.

Patricia
Thank you! This worked for me!
BornReady
Soo nice. Works perfectly.
randomguy