Here is a structure that works for my app in Google Chrome.
I did not check it in other browsers.
- function initDlg( )
- {
- // listen to DOMNodeInserted to finalize the dialog after it is inserted into the DOM
- document.addEventListener( 'DOMNodeInserted', finalizeDialog );
- // render dialog modal and display it
- dialog = new cDialog( '#dialogs', { params . . . } );
- }
- function finalizeDialog( e )
- {
- if( e.srcElement.id == 'tDialogWrapper' ) {
- document.removeEventListener( 'DOMNodeInserted', finalizeDialog );
- // do here what you need to do after the dialog is inserted into the DOM
- }
- }