JqueryUI Dialog问题,尝试关闭对话框

时间:2022-04-07 19:44:07

I am at the moment working on a new project but I have a slight issue, I am using

我目前正在开展一个新项目,但我有一个小问题,我正在使用

    $(".ui-dialog-content").dialog().dialog("close"); 

to close a JqueryUI dialog box from within it, aka a user clicks okay and the dialog box should close.

从其中关闭JqueryUI对话框,也就是用户单击“确定”,对话框应该关闭。

However the above seems to close all open dialog boxes, which is a big issue, is there anything you guys know of that will close a dialog box from within it and only that dialog box.

但是上面似乎关闭了所有打开的对话框,这是一个很大的问题,你们知道有什么会关闭它内部的对话框,只有那个对话框。

Also one last thing to note all dialogs ID's are based on time of opening so trying to close them from there ID is near impossible :(.

最后要注意的是所有对话框的ID都是基于打开的时间,所以试图从那里关闭它们ID几乎是不可能的:(。

Thank you for your help and I will look forward to your reply.

感谢您的帮助,我期待您的回复。

1 个解决方案

#1


0  

With help from the comments I finally fixed it I changed the code to

在评论的帮助下,我终于修复了它,我将代码更改为

$("#submitForm").closest(".ui-dialog-content").dialog("close");

Which closed the dialog and not the others that where open.

哪个关闭对话框而不是其他打开的对话框。

#1


0  

With help from the comments I finally fixed it I changed the code to

在评论的帮助下,我终于修复了它,我将代码更改为

$("#submitForm").closest(".ui-dialog-content").dialog("close");

Which closed the dialog and not the others that where open.

哪个关闭对话框而不是其他打开的对话框。