Detect if a jQuery UI dialog box is open

user208662 picture user208662 · Jul 22, 2010 · Viewed 103.2k times · Source

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?

Answer

Byron Whitlock picture Byron Whitlock · Jul 22, 2010

If you read the docs.

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

This method returns a Boolean (true or false), not a jQuery object.