Thursday, May 31, 2012

How to move an element into another element?


I would like to move one DIV element inside another. For example, I want to move this (including all children):




<div id="source">
...
</div>



into this:




<div id="destination">
...
</div>



so that I have this:




<div id="destination">
<div id="source">
...
</div>
</div>


Source: Tips4all

1 comment:

  1. You want to use the appendTo function:

    $("#source")
    .appendTo("#destination");

    ReplyDelete