JSFiddle - React, Tailwind, and code Playground
by seefeld
HTML
<table id="myTable">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Week 1</th>
<th scope="col">Week 2</th>
<th scope="col">Week 3</th>
<th scope="col">Week 4</th>
</tr>
</thead>
<tbody>
<tr>
<td scope="row">Some Data 1 </td>
<td>33.95%</td>
<td>11.99%</td>
<td>1.96%</td>
<td>0.00%</td>
</tr>
<tr>
<td scope="row">Some Data 1 </td>
<td>40.68%</td>
<td>16.66%</td>
<td>0.93%</td>
<td>1.21%</td>
</tr>
</tbody>
</table>
<div id="div"> </div>
CSS
body { padding: 20px;}
table { width: 350px;}
table th, table td {border: 1px solid #ddd; text-align: center;}
JavaScript
var Cokolwiek = $('#myTable').map(function() {
var rowHead = $('thead tr', this);
var rowBody = $('tbody tr', this);
return {
id: rowHead.find(':nth-child(1)').text(),
text: rowBody.find(':nth-child(2)').text()
};
}).get();
console.log(Cokolwiek);