Bind dialog box

I have a jquery dialog configured with an identifier as shown below.

In document.ready

$('#modal-id').dialog({ autoOpen: false, ...... }) 

and in html

 <div id="modal-id"> <div class="modal-content"> ..... </div> </div> 

Now I need to bind an open dialog event.

 $( "#modal-id" ).bind( "dialogopen", function(event, ui) { .... }); 

The above works, but below does not work

 $( ".ui-dialog-content" ).bind( "dialogopen", function(event, ui) { ... }); 

Any suggestions are welcome.

Update:

 $( ".ui-dialog" ).live( "dialogopen", function(event, ui) { $.getScript("/common/js/jquery.curvycorners.min.js", function() { }); }); 
+4
source share
1 answer

First of all, I don’t think the class you need is .ui-dialog-content , but ui-dialog (maybe I'm wrong). My suggestion would be to use the on method (or live when using old jQuery)

 $(document).on("dialogopen", ".ui-dialog", function(event, ui) { ... }); 

Working example in jsFiddle .

+6
source

Source: https://habr.com/ru/post/1402358/


All Articles