Posted By

kimedgardmonzon on 03/01/10


Tagged

list two clone columns item


Versions (?)

jQuery Divide list items into two using nth-child


 / Published in: JavaScript
 

  1. /*
  2. <div id="latest_left">
  3. <ul>
  4. <li>1<li>
  5. <li>1<li>
  6. <li>1<li>
  7. <li>1<li>
  8. </ul>
  9. </div>
  10. <div id="latest_right">
  11. <!--important it shud be here.-->
  12. </div>
  13. */
  14.  
  15. $("#latest li:nth-child(4)").prependTo("#latest_right");
  16. $("#latest li:nth-child(5)").prependTo("#latest_right");
  17. $("#latest li:nth-child(6)").prependTo("#latest_right");
  18. $("#latest li:nth-child(7)").prependTo("#latest_right");
  19. $("#latest li:nth-child(2)").prependTo("#latest_right");
  20.  
  21. OR
  22.  
  23. /*
  24. <div id="latest_left">
  25. <ul>
  26. <li>1<li>
  27. <li>1<li>
  28. <li>1<li>
  29. <li>1<li>
  30. </ul>
  31. </div>
  32. <div id="latest_right">
  33. <!--important it shud be here.-->
  34. </div>
  35. */
  36.  
  37. $("#latest_left ul").prependTo("#latest_right");

Report this snippet  

You need to login to post a comment.