jQuery reverse array of DOM elements

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() { /* ... */ });

Win an Annual Membership to Learnable,

SitePoint's Learning Platform

  • gmilby

    interesting :)