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.
you can try
if($(".ui-dialog").is(":visible")){
//dialog is open
}
jQuery UI dailog has a method isOpen
which returns true if the dailog is open. Call it on the element which has opened the dialog box.
$('.ui-dialog-content').dialog("isOpen");
Refrence: http://jqueryui.com/demos/dialog/#method-isOpen
According to the API documentation, you should use
$( ".selector" ).dialog( "isOpen" )
to determine whether the dialog is open or not. The function returns a boolean. For example,
if( $("selector").dialog("isOpen")===true ){
/*do stuff when dialog is open*/
} else {
/*do stuff when dialog is closed*/
};
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