Thursday, February 26, 2009

[jQuery] Re: HELP: a = $('

foo

bar

'); a.after('xyz') not adding element

Nodes can be manipulated without being part of the DOM, for example like
this:

var node = $('<div class="aewsoem"></div>')[0];

$('<span class="great"></span>').appendTo(node);

$("body").append(node);


Just note that jQuery always returns a collection of nodes, so if you
create one to access it you have to take the first from this collection
with the [0].

drx


> For those methods to work, the html has to be part of the DOM first.
>
> On Feb 26, 3:33 am, stephen <stephen.cant...@gmail.com> wrote:
> > Hello,
> >
> > has anybody managed to prepend and append elements to a set of dom
> > elements previously created on the fly with the "$(html)" function?
> >
> > I've tried with append, prepend, after, before, etc without any
> > luck...
> >
> > Is there a way to do it?
> >
> > Stephen

--
New Bodenständig 2000 record / Neue Bodenständig 2000 Schallplatte:
http://bodenstandig.de/2000/
Home Page: http://drx.a-blast.org/~drx/

No comments: