fix for loop through elements in reverse order

Scenario:-  Loop through Elements Backwards

We all know each() lets us easily loop through elements, but what if we need to go backwards? Here’s the trick:


var reversedSet = $(“li”).get().reverse();

//Use get() to return an array of elements, and then reverse it
//Now we can plug our reversed set right into the each function.


I Am suresh(suresh kumar )a Web developer,Freelancer,webdesigner,UI developer from bangalore. Got 6+ yrs of IT experience . I specialize in standards-based XHTML, CSS and JavaScript web development. Each site I develop is built to be search engine friendly (SEO), using the latest development principles and techniques.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *