Try this...

$('<div class="subdiv">').appendTo("#font-container").html("<p>Lorem
ipsum ...</p>")

Isn't chaining great?!

George

On Jun 12, 8:21 pm, Brad Perkins <[EMAIL PROTECTED]> wrote:
> Thanks Franck!
>
> I had something working but that is more compact.
>
> Since I will need to place content into the inserted div I need to
> select the last inserted div. Using your suggestion, I've come up with
> something like:
>
> var c = $("#font-container");
> c.append('<div class="subdiv">');
> c.children("div:last-child").html("<p>Lorem ipsum ...</p>"); // get
> the last inserted div
>
> Is there a better way?
>
> On Jun 12, 12:46 pm, Franck Marcia <[EMAIL PROTECTED]> wrote:
>
>
>
> > This should work:
> > $('#form_containter').append('<div id="row1">');
>
> > then
> > $('#form_containter').append('<div id="row2">');
>
> > and so on...
>
> > Franck.
>
> > On 12 juin, 18:39, Brad Perkins <[EMAIL PROTECTED]> wrote:
>
> > > In looking at the DOM manipulation commands I'm not clear on the best
> > > way to insert a div into an existing div. More specifically I need to
> > > do something like this:
>
> > > Start with an empty div
> > > <div id="form_container">
> > > </div>
>
> > > Insert a div...
> > > <div id="form_container">
> > >   <div id="row1">...</div> <-- inserted
> > > </div>
>
> > > And another ...
> > > <div id="form_container">
> > >   <div id="row1">...</div>
> > >   <div id="row2">...</div> <-- inserted
> > > </div>
>
> > > etc.
>
> > > I want every inserted div to be the last div within "form_container".
>
> > > Thanks,
>
> > > Brad Perkins- Hide quoted text -
>
> - Show quoted text -

Reply via email to