Dynamically created DIV + Dialog = no show :(

Dynamically created DIV + Dialog = no show :(


Added a click function to an anchor tag <a href=""
id="newDialog">click here</a>
I am creating a div and adding content to the div and appending it to
the body.
Then I want to open a dialog box with the content I've created
dynamically.
Check the code below:
$('#newDialog').click(function(e) {
    $('<p id="newDialogText">')
    .html('Some HTML Text')
    .css('display', 'none')
    .appendTo("body");
$("#newDialogText").dialog("open");
return false;
});
In checking the generated HTML, the DIV is created. However, the
dialog doesn't open it.
Any help is appreciated.
Thanks!