Trigger event on dialog box open

后端 未结 4 1503
误落风尘
误落风尘 2021-02-05 06:18

My dialog box is defined under the div

#dialogbox

When the dialog box opens i want to trigger an event such that it alerts open. The code im us

4条回答
  •  感情败类
    2021-02-05 06:59

    Try this:

    jsFiddle here

    HTML:

    Javascript/jQuery:

    $("#dialogbox").dialog({
        autoOpen:false,
        modal:true,
        title: "Use of Open event",
        width:300,
        open: function( event, ui ) {
            alert('hello');
        }
    });
    
    $('#mybutt').click(function() {
        $('#dialogbox').html('

    Watch this

    An alert box should have opened'); $('#dialogbox').dialog('open'); });

提交回复
热议问题