jquery: reverse an order
问题 How can I reverse an order with jquery? I tried with the suggestion like this but it won't work! $($(".block-item").get().reverse()).each(function() { /* ... */ }); Have a look here. I want the boxed to be rearranged like this, 18 17 16 etc Thanks. 回答1: If you have a container around the list, it's a little easier: $("#container").append($(".block-item").get().reverse()); http://jsfiddle.net/BhTEN/12/ 回答2: You can use this: $($(".block-item").get().reverse()).each(function (i) { $(this).text(