Clone table header and replace header's th with td
var tableHeaderRow = '#tableId tbody tr:nth-child(1)'; // this is th.
var copy = $(tableHeaderRow).clone();
$('#tableViewHeader').prepend(copy); // add this row as the first element in parent container. $('#tableViewHeader').find('th').wrapInner('<td />').contents().unwrap();
$('#tableViewHeader').find('tbody').contents().unwrap();