title: Add values of previous rows for column jquery
body: <p>I am trying to add the values of the previous rows in the column I click using jquery.
  At the moment I have the following code :</p>
  
  <pre><code>$( document ).ready(function() {
  $('td').click(function()
  {
      var col = $(this).parent().children().index($(this));
      var row = $(this).parent().parent().children().index($(this).parent());
      console.log('Row: ' + row + ', Column: ' + col);
      var val1=0;
      var val2=0;
      var t = document.getElementById('hours');
      for (i = 1; i &lt; row; i++) 
      { 
          var val1=$(t.rows[i].cells[col]).text();
          console.log('Row: ' + i + ', Column: ' + col);
          console.log($('#hours tr:eq('+i+') td:eq('+col+')').text);
          val2 += Number(val1);
      }
  });
  </code></pre>
  
  <p>});</p>
  
  <p>I've got the right column but having trouble pulling the values.
  The table ID is : hours</p>
  
  <p><a href="http://jsfiddle.net/BigGrecian/0cc2k2zg/" rel="nofollow">http://jsfiddle.net/BigGrecian/0cc2k2zg/</a></p>