title: Automatically calculate sum of the dynamic textbox values
body: <p>I am making an php , mysql website for billing... I want to get the sum of the values in text box.. The rows can be added according to the user requirement... but .. I tried most of things.. but not getting right.... how to get the sum of all the textbox values in the last column rate... I mean without any user input such as button click..... could somebody help me with this code.....</p>
  
  <p>thanks in advance..</p>
  
  <p>code I made for adding rows to table..</p>
  
  <pre><code>         function addRow(tableID) {
          var table = document.getElementById(tableID);
  
          var rowCount = table.rows.length;
          var row = table.insertRow(rowCount);
  
          var cell1 = row.insertCell(0);
          var element1 = document.createElement("input");
          element1.type = "text";
          element1.name="s_no[]";
          element1.size="25";
          element1.value = rowCount;
          cell1.appendChild(element1);
  
  
          var cell2 = row.insertCell(1);
          var element2 = document.createElement("input");
          element2.type = "text";
          element2.name="p_id[]";
          element2.size="25";
          cell2.appendChild(element2);
  
          var cell3 = row.insertCell(2);
          var element3 = document.createElement("input");
          element3.type = "text";
          element3.name="p_name[]";
          element3.size="25";
          cell3.appendChild(element3);
  
          var cell5 = row.insertCell(3);
          var element5 = document.createElement("input");
          element5.type = "text";
          element5.name="mrp[]";
          element5.size="25";
          cell5.appendChild(element5);
  
          var cell6 = row.insertCell(4);
          var element6 = document.createElement("input");
          element6.type = "text";
          element6.name = "qty[]";
          element6.size="25";
          cell6.appendChild(element6);
  
          var cell7 = row.insertCell(5);
          var element7 = document.createElement("input");
          element7.type = "text";
          element7.name = "rate[]";
          element7.size="25";
          cell7.appendChild(element7);
  
          var cell8 = row.insertCell(6);
          var element8 = document.createElement("input");
          element8.type = "checkbox";
          element8.name = "check";
          cell8.appendChild(element8);
  
  
  
  
  }
  </code></pre>
  
  <p>Html code for table:
  
  </p>
  
  <p>
  
   
  
      </p>
  
  <pre><code>    &lt;th width="17%"&gt;&lt;label&gt;S.No&lt;/label&gt;&lt;/th&gt;
      &lt;th width="17%"&gt;Product Id&lt;/th&gt;
      &lt;th width="17%"&gt;Product Name&lt;/th&gt;
      &lt;th width="17%"&gt;MRP&lt;/th&gt;
      &lt;th width="17%"&gt;Qty&lt;/th&gt;
      &lt;th width="18%"&gt;Rate&lt;/th&gt;
      &lt;th width="18%"&gt;Check&lt;/th&gt;
  
  
  &lt;/tr&gt;
  </code></pre>
  
  <p><br>
        Total
  
  </p>