J82
J82

Reputation: 2387

jQuery: How can I remove a div and put it somewhere else?

<div id="wrapper">
     <div id="example1">
          <div id="navigation">
          </div>
     </div>
     <div id="example2">

     </div>
</div>

In the above example, let's say I want to remove #navigation from #example1 and place it in #example2. How can I use jQuery to do that? Do I just use remove and add or is there a simpler way?

Upvotes: 7

Views: 4981

Answers (1)

amosrivera
amosrivera

Reputation: 26514

$("#navigation").appendTo("#example2");

Upvotes: 15

Related Questions