JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<td class="checkallprice">300</td>
<td class="checkallprice">110</td>
<td class="checkallprice">350</td>
<td class="checkallprice">100</td>
<td class="checkallprice">I need Total Here</td>
</tr>
</table>
JavaScript
$(document).ready(function(){
function calculateTotal() {
var total = 0;
jQuery(this).prevAll().each(function() {
total += Number(jQuery(this).text());
});
return total;
}
$('.checkallprice').last().text(calculateTotal);
});