Cloning table header to the bottom of table with reverse

/ Published in: jQuery

Snippet may be usefull for cloning table header to the bottom of table.

Snippet will clone all children elements from thead, reverse and insert to tfoot. Example at jsFiddle: <a href="">jsFiddle</a>

Copy this code and paste it in your HTML
  1. var $tfoot = $('<tfoot></tfoot>');
  2. $($('thead').clone(true, true).children().get().reverse()).each(function(){
  3. $tfoot.append($(this));
  4. });
  5. $tfoot.insertAfter('table thead');


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.