Jquery dialog box delay event

I’m using the basic source from http://jqueryui.com/demos/dialog/ to initiate a dialog box as a page loads. However, I’d like to delay it by 5 seconds, can anyone help?


    <script type="text/javascript">
    $.ui.dialog.defaults.bgiframe = true;
    $(function() {
        $("#dialog").dialog();
    });
    </script>

The html script tags have been stripped out of this sample code, as they are only appropriate for when using inline javascript.


$.ui.dialog.defaults.bgiframe = true;
$(function() {
    window.setTimout(function () {
        $("#dialog").dialog();
    }, 5000);
});

Thanks that worked a treat. Just for future ref there was a minor typo ie window.setTimeout

Actually just discovered there’s a glich with this in that the dialog text is rendered on screen until the 5 seconds expire then it’s removed and inserted into the dialog box which appears. Adding display: none to the dialog div fixed it.