I have several dialogs that open like this
$("#dialog").load(URL);
$("#dialog").dialog(
attributes,
here,
close: function(e,u) {
cleanup
}
The issue is that I have hundreds of these dialogs. I do not want to manually have to create an open: attribute for each one. Is there any way I can monitor the entire document for a dialog open such as
$(document).on("open","#dialog",function() {
Do something
})
The jQuery UI dialog method is used to create a basic dialog window which is positioned into the viewport and protected from page content. It has a title bar and a content area, and can be moved, resized and closed with the 'x' icon by default.
From jQuery API:
$( ".selector" ).on( "dialogopen", function( event, ui ) {} );
So you could do what you said probably:
$("body").on("dialogopen",function(e,u){
alert('dialog open!');
});
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