Import values from rows of one table to header of another table

I want to import values from row of one table to header of another table. Here is my code

<div id="pList" //only one table is getting created inside this div i.e. table 1 </div <div id="div" //table 2, table 3 and so on... multiple tables are getting created inside this div </div

var showTable = $(‘#pList’).find(‘tr’).eq(h);

// For “selected” row of table1 …
var rowFromTable1 = showTable;

// … Take a clone/copy of it …
var clonedRowFromTable1 = rowFromTable1.clone();

// … And append the cloned row to the thead of table2
$(‘thead’, ‘#div’).append(clonedRowFromTable1);

But it copies selected row and all following rows of table 1 to header of table 2. Also, the row has an input field in which I enter a value. It copies the input field as a whole and not just the value. How do I solve that too? Please help!


Here is my site Read-Only: LINK
(how to share your site Read-Only link)