开发者

Div disappears from original place after closing the dialog

开发者 https://www.devze.com 2023-04-11 08:20 出处:网络
I am trying to use jquery dialog. My requirement is to open a dialog box from a content which is already present on page.

I am trying to use jquery dialog. My requirement is to open a dialog box from a content which is already present on page.

But when I am closing an dialog box that element disappears from page. I want it to be present on the same place after closing the dialog.

Can somebody guide me on this?

Thanks S开发者_JAVA技巧ubhash


When we call for dialog, jquery takes that div, appends it to new Dialog div, and this dialog div is appended to body and then it remains over there. Now whenever a dialog function is called same div is popped up.

So what I did, on close of dialog , I destroyed dialog div, (It removed dialog div from body). Then appended my own div to previous position.

close : function(event, ui)
            {
                $("#myDiv").dialog("destroy");
                $(this).removeClass();
                $(this).removeAttr("style");
                $(this).appendTo($("#originalParentDiv"));
            }


I believe jQuery moved the div into the dialog when you open.

You might need to first make a copy of it and then open the dialog with the copy, and manualy update the original if you need.

0

精彩评论

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