I want to create html table dynamically and number of table will be depend upon the response I am getting in array. New table should be created after every 6 elements and table header will be array elements itself. Expected output is-
-------------------------------------
| th1 | th2 | th3 | th4 | th5 | th6 |
-------------------------------------
| | | | | | |
-------------------------------------
code for generating table is as below in which consoles are printing properly but elements are not getting create and not getting any error too.
'<div id="findingDiv">';
for(var i=0;i<tables;i++){
console.log('i-',i);
'<table class="table table-bordered" style="margin-top: 10px; border:1px solid black; border-collapse : collapse;font-size: 30px;">'+
'<thead>'+
'<tr>';
for(var k=0;k<6;k++){
'<th id="header" style="color:black; font-size: 12px; border:1px solid black; text-align:center;border-color: rgb(166, 166, 166);"> historyTable[k] </th>';
console.log('k-',k);
}
'</table> \n';
}
Can anybody help me??
I have checked previous solutions which did not worked. How to clone() a element n times? How to use loop in Jquery to add table multiple times into div Create a table dynamically using for loop in .html()