JavaScript
Article

jQuery reverse array of DOM elements

By Sam Deering

Quick jQuery code snippet a bit like jQuery.each backwards I suppose. Could come in handy to loop through elements backwards.

$($("li").get().reverse()).each(function() { /* ... */ });
Sam Deering
Meet the author
Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.
  • gmilby

    interesting :)

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!