简体   繁体   中英

call a ui-dialog box using javascript function

I need to open (call) a ui-dialog box from a function javascript. Currently I have these two codes:

setTimeout(function() {
var zone = event.getTarget().getName();                  
var x = window.confirm("Do you want to continue?");                     
if (x) {
    readData();
} else {
    e.preventDefault();
}
}, 0);

and,

$( "#dialogZone" ).dialog({
autoOpen: false,
show: "blind",
hide: "blind",
modal: true,
buttons: {
    "YES": function() {
        $(this).dialog("close");
        readData();
    },
    Cancel: function() {
        $(this).dialog("close");
        //avoid some info windows in #tab1
    }
}
});

$( "#openEvent" ).click(function() {
$( "#dialogZone" ).dialog( "open" );
return false;
});
});

Please, can I have some thing like...

setTimeout(function() {
   // show ui-dialogbox
}

Thanks in advance for your answers. Regards.

You already have it in your code:

  $( "#dialogZone" ).dialog( "open" ); 

to open dialog, so put this line in your timeouted function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM