JSFiddle - React, Tailwind, and code Playground
by David Thomas
HTML
<table id="cartGrid">
<thead>
<tr>
<th>Item Description</th>
<th>Qty</th>
<th>Unit Price</th>
<th>Ext Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Old Lamp</td>
<td>1</td>
<td>107.00</td>
<td>107.00</td>
</tr>
<tr>
<td>Blue POst</td>
<td>2</td>
<td>7.00</td>
<td>14.00</td>
</tr>
</tbody>
</table
JavaScript
var details = $('tbody tr').map(function (i, row) {
return {
'description': row.cells[0].textContent,
'quantity': row.cells[1].textContent,
'unitPrice': row.cells[2].textContent,
'extPrice': row.cells[3].textContent
}
}).get();
console.log(details);