jQuery reverse array of DOM elements

Sam Deering
Tweet

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

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • gmilby

    interesting :)