开发者

Cannot reopen jquery ui dialog after closing it

开发者 https://www.devze.com 2023-02-04 20:49 出处:网络
I have a link on my website which opens a html content from a different webpage in a jquery ui dialog:

I have a link on my website which opens a html content from a different webpage in a jquery ui dialog:

var $otherDialogContainer = $('#other-dialog');

$('a.link').click(function() {
    $otherDialogContainer.load('/controller/action', function() {
        $otherDialogContainer.dialog({
        title: 'Hello',
            width: 600,
            height: 400,
       开发者_如何学运维     position: 'middle',
            resizable: false
        });
    });
    return false;
});

In the html that's opened in the dialog there is a button which closes the dialog like this:

$('.closeDialog').click(function() {
        window.parent.$(".ui-dialog").remove();
    });

The problem is, I cannot reopen the dialog after I close it with that button. If I close the dialog by clicking the 'x' icon in the top right corner, I can reopen it without a problem.


.remove() removes the dialog from the DOM so there is no longer a dialog to open :)

You should use

$otherDialogContainer.dialog('close');

Hope this helps!

0

精彩评论

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