Return to Snippet

Revision: 24376
at November 8, 2010 16:26 by kimedgardmonzon


Updated Code
/*
<div id="latest_left">
<ul>
<li>1<li>
<li>1<li>
<li>1<li>
<li>1<li>
</ul>
</div>
<div id="latest_right">
<!--important it shud be here.-->
</div>
*/

$("#latest li:nth-child(4)").prependTo("#latest_right");
$("#latest li:nth-child(5)").prependTo("#latest_right");
$("#latest li:nth-child(6)").prependTo("#latest_right");
$("#latest li:nth-child(7)").prependTo("#latest_right");
$("#latest li:nth-child(2)").prependTo("#latest_right");

OR

/*
<div id="latest_left">
<ul>
<li>1<li>
<li>1<li>
<li>1<li>
<li>1<li>
</ul>
</div>
<div id="latest_right">
<!--important it shud be here.-->
</div>
*/

$("#latest_left ul").prependTo("#latest_right");

Revision: 24375
at March 1, 2010 02:40 by kimedgardmonzon


Initial Code
/*
<div id="latest_left">
<ul>
<li>1<li>
<li>1<li>
<li>1<li>
<li>1<li>
</ul>
</div>
<div id="latest_right">
<!--important it shud be here.-->
</div>
*/

$("#latest li:nth-child(4)").prependTo("#latest_right");
$("#latest li:nth-child(5)").prependTo("#latest_right");
$("#latest li:nth-child(6)").prependTo("#latest_right");
$("#latest li:nth-child(7)").prependTo("#latest_right");
$("#latest li:nth-child(2)").prependTo("#latest_right");

Initial URL


Initial Description


Initial Title
jQuery Divide list items into two using nth-child

Initial Tags
list

Initial Language
JavaScript