title: Add table column cells with input textbox and without
body: <p>I am adding the values of a column in a table with the following javascript function:</p>
  
  <pre><code>function sumOfColumns(tableID, columnIndex, hasHeader) {
      var tot = 0;
      $("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : ""))
      .children("td:nth-child(" + columnIndex + ")")
      .each(function() {
          tot += $(this).html();
      });
      return tot;
  }
  </code></pre>
  
  <p>I would like to modify it so it adds not only the numbers in the cell, but also include the value of textboxes in cells. A cell can either have a number or a textbox with a number.</p>
  
  <p>The following cells should add up to 2115:</p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;&lt;td&gt;100&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;&lt;input type="text" value="5" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;10&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;&lt;input type="text" value="2000" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>How can I do this most efficiently?
  Thanks for your input!</p>