I have 3 divs want to reverse the order on doucment ready
<div id="block-1">First</div>
<div id="block-2">Second</div>
<div id="block-3">Third</div>
How can I do this in jquery?
<div id="parent">
<div id="block-1">First</div>
<div id="block-2">Second</div>
<div id="block-3">Third</div>
</div>
And try this in Jquery
$('#parent > div').each(function() {
$(this).prependTo(this.parentNode);
});
You can see example in jsfiddle http://jsfiddle.net/N7PGW/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With