Good day, I am looking to create an HTML table that reads data from a separate table using JQuery. I found a code snippet online but after including that into my project no new data displayed in my table. Please could you help me figure out what the problem is ? Below is the JS code snippet I am incorporating and the code for my two datatables.
“”"
JS Code Snippet:
$("#table1").find("thead").each(function(){
$table1Head=$(this).find("th");
$("#table3 thead").append("<th>"+$table1Head.eq(1).text()+ " </th>");
$("#table3 thead").append("<th>"+$table1Head.eq(1).text()+ " </th>");
$("#table3 thead").append("<th>"+$table1Head.eq(1).text()+ " </th>");
$("#table3 thead").append("<th>"+$table1Head.eq(1).text()+ " </th>");
});
$("#table1 tbody").find("tr").each(function(){
$table3data=$(this).find("td");
$("#table3 tbody").append("<tr>"+
"<td>" + $table3data.eq(1).text() + "</td>" +
"<td>" + $table3data.eq(2).text() + "</td>" +
"<td>" + $table3data.eq(4).text() + "</td>" +
"<td>" + $table3data.eq(5).text() + "</td>" +
"</tr>");
});