How to close all jquery ui dialog before open a new dialog?

孤人 提交于 2019-12-07 07:20:58

问题


I want to close all jquery dialogs before open a new dialog.

I'm trying with following code.

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

It works but it too close new dialog too.

please help me anyone.


回答1:


Try:

$(".ui-dialog-content").not(<selector for the dialog you don't want to close>).dialog("close");



回答2:


Just ran into this myself. I solved it like this. .dialog is a class that all the elements I made into dialogs share.

$(".ui-dialog:visible").find(".dialog").dialog("close");



回答3:


How are you opening the new Dialog? You must be opening each dialog using it's own code, e.g.

$('#dialog1').dialog();
$('#dialog2').dialog();

etc... in order to open each individually?

Just give them all a class name class="opened-dialogs" then call $('.opened-dialogs').dialog("close"); before then opening the new one.



来源:https://stackoverflow.com/questions/7470389/how-to-close-all-jquery-ui-dialog-before-open-a-new-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!