9grid Jquery

How to calculate column value in Jquery?

We need to calculate column value when we are working with items that having respective prices for each row. So at bottom we can calculate total price.


<b>Calculate Total Item Price</b>

<table border=”1″>

    <tr><td>Items Name</td><td>Price</td></tr>








var result = [];

  $(‘table tr’).each(function(){

   $(‘td’, this).each(function(index, val){

     if(!result[index]) result[index] = 0;

      result[index] += parseInt($(val).text());





   $(‘table tr’).last().append(‘<td>’+this+'</td>’)




Leave a comment

Your email address will not be published. Required fields are marked *