JQuery .each() backwards

Posted by Jack Mills on Stack Overflow See other posts from Stack Overflow or by Jack Mills
Published on 2009-09-08T13:24:37Z Indexed on 2010/06/17 4:03 UTC
Read the original article Hit count: 154

Filed under:

Hi, I'm using JQuery to select some elements on a page and then move them around in the DOM. The problem I'm having is I need to select all the elements in the reverse order that JQuery naturally wants to select them. For example:

<ul>
   <li>Item 1</li>
   <li>Item 2</li>
   <li>Item 3</li>
   <li>Item 4</li>
   <li>Item 5</li>
</ul>

I want to select all the li items and use the .each() command on them but I want to start with Item 5, then Item 4 etc. Is this possible?

Thanks

© Stack Overflow or respective owner

Related posts about jQuery