place sum of one td data to onother td of next tr by jquery -
$(document).ready(function() { $(".row_val td").each(function() { var x = $(this).children('.val1').text(); var y = $(this).children('.val2').text(); $(this).addclass("green") var z = x+y; $(this).parent().next("tr").("td").(".sum").html() = z; // alert(z); }) });
how load sum of 1 td data td of next tr jquery? please see https://jsfiddle.net/id10922606/y4wmhcw9/11/
you like
$(document).ready(function() { var obj = { val1: 0, val2: 0 }; $('.row_val').find('.val1, .val2').each(function() { obj[this.classname] += +$(this).text() || 0; }); var $sums = $('.rowsubvalue .sum'); $sums.eq(0).text(obj.val1.tofixed(2)); $sums.eq(1).text(obj.val2.tofixed(2)); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <tr class="row_val"> <td> <div>act/proj</div> <div>rev. bus./lrp</div> </td> <td> <div class="val1">8.5</div> <div class="val2">5.6</div> </td> <td> <div class="val1">8.5</div> <div class="val2">5.6</div> </td> <td> <div class="val1">8.5</div> <div class="val2">5.6</div> </td> </tr> <tr class="variance_brdr rowsubvalue"> <td> <div>variance</div> </td> <td> <div class="sum"></div> </td> <td> <div class="sum"></div> </td> </tr> </table>
Comments
Post a Comment