记录:jQuery make div element positions reorder
<div id="container">
   <div id="1"></div>
   <div id="2"></div>
</div>

In the example you are showing you can simply use the append, and prepend jquery methods. For example, div#1 then div#2 $('#container').append('#1').append('#2'); Reorder, div#2 then div#1 $('#container #2').remove().prependTo('#container'); There are many ways you could write this. Just remember prepend places an element at the beginning (before the first element) of the container, while append places the element after the last element.

1 2


1