How does one close all jquery ui dialog windows in javascript?
Situation:
The page has multiple things that can be opened using the dialog boxes. I need a way to close all previous windows before opening a new one.
How does one close all jquery ui dialog windows in javascript?
Situation:
The page has multiple things that can be opened using the dialog boxes. I need a way to close all previous windows before opening a new one.
They all have the .ui-dialog-content
class, so select by that and close them, like this:
$(".ui-dialog-content").dialog("close");
$(".class1, .class2")
–
Tub Be careful with the above. If you define a close method for your dialog, it will get fired even if the dialog is not open. This was a huge issue in an Angular project where we were manually calling $apply() in our dialog close method. Another event was trying to close all dialogs on the screen and our close method was called even though wasn't open resulting in a digest issue.
© 2022 - 2024 — McMap. All rights reserved.