开发者

Jquery closing dialog and removing div

开发者 https://www.devze.com 2023-01-08 09:44 出处:网络
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 conta

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 i开发者_StackOverflowdentical 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?


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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消