How to close jQuery UI dialog in x seconds?

How can I programmatically close the jQuery UI dialog after some seconds?

I suppose I need to do something inside

window.setTimeout(function() {
    //Something here....
}, 10000);
+5
source share
2 answers

Try $('#idOfYourDialogue').dialog("close");

and see http://docs.jquery.com/UI/Dialog

+14
source
var xSeconds = 2; // 2 seconds
var myDialog = $('dialog_element').dialog('open');
setTimeout(function() { myDialog.dialog('close'); }, xSeconds * 1000);
+3
source

All Articles