Couple of things.  You say the DIV is created, but your code shows a
paragraph tag.  I would use a div instead.  Also, you have the css set
to hidden.  So, when you make the dialog it is still hidden.  Also,
you don't need the "open" command for the dialog.  You don't even need
to append the new content to the body (this will be done by the
dialog.  Your code can really be as simple as this:

$('#newDialog').click(function(e) {
        $('<div id="newDialogText">Some HTML Text</div>').dialog();
        return false;
});

Hth,

Dave

On Mar 20, 10:50 pm, Loony2nz <[email protected]> wrote:
> 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"></p>')
>         .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!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to