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="http://jsfiddle.net/xWWYN/">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');

URL: http://goo.gl/ZcNLf

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.