How to Add Two Columns Together with jQuery
Learn how to combine two table columns with jquery to make a total column without having to make this calculation on backend.
This is a short tutorial on how to add two columns together to add them and put them in a total column.
<td class="lm_grid">
<tr>
<td class="countone">60</td>
<td class="counttwo">105</td>
<td class="total"></td>
</tr>
</td>
$( document ).ready(function() {
$('.lm_grid tr').each(function(){
var val1 =$(this).find(".countone").text();
var val2 =$(this).find(".counttwo").text();
var ata = parseFloat(val1);
var eta = parseFloat(val2);
var at = ata + eta;
var result = at;
var result_print =$(this).find(".total").text(result);
});
});