Reputation: 263
Here's some example code
<div id="one">One</div><div id="two">Two</div><div id="three">Three</div>
And let's say the CSS is
div {float:left;}
Is there anyway to make the divs appear as Three, Two, One, besides something like float:right
? JavaScript and jQuery not excluded.
Upvotes: 4
Views: 287
Reputation: 6344
That's actually the exact example used on this JQuery documentation page for $.makeArray()
:
var elems = document.getElementsByTagName("div");
var arr = jQuery.makeArray(elems);
arr.reverse();
$(arr).appendTo(document.body);
Upvotes: 5