I have several divs in two separate containing divs, the order of the first div changes on every page load, and i need to append the second list to the first in order.
<div id="one">
<div><p>Sample text 1</p></div>
<div><p>Sample text 2</p></div>
<div><p>Sample text 3</p></div>
<div><p>Sample text 4</p></div>
</div>
<div id="two">
<div><p>Sample text 5</p></div>
<div><p>Sample text 6</p></div>
<div><p>Sample text 7</p></div>
<div><p>Sample text 8</p></div>
</div>
i can do the first one no problem, but how do I loop this increasing n by 1 each loop.
$(document).ready(function($) {
$("#two div:first-child").appendTo("#one div:nth-child(n)");
});
EDIT: Sorry i havent explained very well, this is the output i am after
<div id="one">
<div><p>Sample text 4</p>
<div><p>Sample text 5</p></div>
</div>
<div><p>Sample text 2</p>
<div><p>Sample text 6</p></div>
</div>
<div><p>Sample text 3</p>
<div><p>Sample text 7</p></div>
</div>
<div><p>Sample text 1</p>
<div><p>Sample text 8</p></div>
</div>
</div>
<div id="two">
</div>
So each div from the second group is placed inside each div from the first group, the first group is randomly jumbled up, and i need to append the second set of divs in their original order...im sorry, my describing is less than perfect!