Re: Moving DOM Nodes

RobG
Wed, 19 Sep 2007 11:57:14 -0000

On Sep 19, 8:10 pm, Frederic JECKER
<f.jec...-Q24KPKXrcE4YLvoOxY5KjA@public.gmane.org>
wrote:
> Moin List,
>
> Is there a "simple" way for moving DOM nodes and insert them into
> another DOM part ?
> Example: Moving a DIV into another DIV.
> I''m actually using prototype Insertion to manage to do this but
this
> solution doesn''t satisfies me.

Assign the node you want to move as a child of the node you want to
make it a child of, e.g.

<input type="button" value="Move option" onclick="
  $(''A'').appendChild($(''B'').options[0]);
">


A 1
A 2


B 1
B 2