How to tell if any jquery dialog happens to be open?

lamont picture lamont · Feb 3, 2012 · Viewed 16.9k times · Source

Looking for a general case solution to determine if any jquery dialog (there are multiple) is currently open. Have tried:

$(".ui-dialog-content").dialog("isOpen") === true
$(".ui-dialog").dialog("isOpen") == true
$(document).dialog("isOpen") == true
$("*").dialog('isOpen') == true

without any success. I expected ".ui-dialog-content" to work, since I can apparently close any open dialog with that selector, but it does not.

Answer

Rafay picture Rafay · Feb 3, 2012

you can try

if($(".ui-dialog").is(":visible")){
//dialog is open
}