Usually we want to separate the creation of the dialog from its appearance. Then three steps are needed.
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
autoOpen: false
option that ensures that it will be closed at first$( "#dialog" ).dialog({
autoOpen: false
});
$( "#dialog" ).dialog( "open" );