SO fiddle
Test Fiddle mainly for SO Questions
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/overcast/jquery-ui.css">
<content>
<dom id="1">a</dom>
<dom id="2">b</dom>
<dom id="3">c</dom>
<dom id="4">d</dom>
</content>
JavaScript
(function($) {
$.fn.reverseOrder = function() {
return this.each(function() {
$(this).prependTo( $(this).parent() );
});
};
})(jQuery);
$("content dom").reverseOrder();