I have the following code to detect if a jquery ui dialog is open:
if ($("#dialog-myDialog").dialog("isOpen")) {
return;
}
which works fine but I found a situation where this code get called prior to the dialog being initialized in the first place and this if statement seems to just blow up in this case.
What is the best way to check if a jquery ui dialog has been initialized so I can properly handle this situation.
Test whether the element has the ui-dialog-content
class:
if ($("#dialog-myDialog").hasClass("ui-dialog-content") &&
$("#dialog-myDialog").dialog("isOpen")) {
return;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With