Reverse table data

Not long ago I had to reverse the data of a huge table. It would have been crazy to do it manually, considering that jQuery can solve it in 3 lines. Here is the solution I found and used:

$('tbody').each(function(){
	var list = $(this).children('tr');
	$(this).html(list.get().reverse())
});

DEMO

After running the script, you can easily copy the markup and keep it the way you want on your page.

Leave a Reply

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