JavaScript
Article
By Sam Deering

jquery .each backwards (reverse it)

By Sam Deering

Quick jQuery snippet to reverse each to loop over elements backwards. Example shows effect on loop over a list backwards.

--ADVERTISEMENT--

$($("li").get().reverse()).each(function() { /* ... */ });
Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account