title: How to set a total in a column in a table?
body: <p>I have a basic table with names and prices generated according to buttons in the website. I need to compute the total for this table.</p>
  
  <pre><code>&lt;table id="countit"&gt;
   &lt;tr&gt;
     &lt;th &gt;name&lt;/th&gt;
     &lt;th &gt;price&lt;/th&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
     &lt;td  id ="name"&gt;&lt;/td&gt;       //this is dynamically generated through buttons
     &lt;td id ="price" &gt;&lt;/td&gt;      //this is dynamically generated through buttons
   &lt;/tr&gt;
   &lt;tr&gt;
     &lt;th &gt;total&lt;/th&gt;
     &lt;th id="grandtotal" &gt;&lt;/th&gt;   //total goes here
   &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Can anyone tell me how to do it in Javascript, please?</p>