user208662 user208662 - 7 months ago 11
Javascript Question

Detect if a jQuery UI dialog box is open

I am using a jQuery UI dialog. If it is open, I want to do one thing. If it is closed, I want to do another. My question is, how do I detect if a jQuery UI dialog box is open or not?

Thank you.

Answer

If you read the docs.

$('#mydialog').dialog('isOpen')

You need to explicitly compare this with true to avoid the dialog being returned as an object.