title: Add function not working
body: <p>I wrote below the javascript which will allow user to add and delete the row and calculate the weighting. The addition and deletion are working fine but I believe I am unable to do sum of weighting. Can you please advise ?</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 = "checkbox";
      element1.name="chkbox[]";
      cell1.appendChild(element1);
  
      var cell2 = row.insertCell(1);
      var element2 = document.createElement("input");
      element2.type = "text";
      element2.name = "txtbox[]";
      cell2.appendChild(element2);
  
      var cell3 = row.insertCell(2);
      var element3 = document.createElement("input");
      element3.type = "text";
      element3.name = "txtbox[]";
      cell3.appendChild(element3);
  
      var cell4 = row.insertCell(3);
      var element4 = document.createElement("input");
      element4.type = "text";
      element4.name = "txtbox[]";
      element4.class = "wtotal1";
      cell4.appendChild(element4);
  }
  
  function deleteRow(tableID) {
      try {
      var table = document.getElementById(tableID);
      var rowCount = table.rows.length;
  
      for(var i=0; i&lt;rowCount; i++) {
          var row = table.rows[i];
          var chkbox = row.cells[0].childNodes[0];
          if(null != chkbox &amp;&amp; true == chkbox.checked) {
              table.deleteRow(i);
              rowCount--;
              i--;
          }
      }
      }catch(e) {
          alert(e);
      }
  }
  
  function weighttotal1(){
          var tweight1 = 0;
          var cusid_ele = document.getElementsByClassName('wtotal1');
          for (var i = 0; i &lt; cusid_ele.length; ++i) {
            if (!isNaN(parseFloat(cusid_ele[i].textContent)) )
              tweight1 += parseFloat(cusid_ele[i].textContent);  
          }
          document.getElementById('tweight1').value=tweight1;
          }
  
  
  &lt;table id="dataTable1" class="table table-condensed table-hover table-responsive table-striped table-bordered"&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;th&gt;&lt;/th&gt;
              &lt;th&gt;ComponentId&lt;/th&gt;
              &lt;th&gt;Component Description&lt;/th&gt;
              &lt;th&gt;Weighting&lt;/th&gt;
          &lt;/tr&gt;
       &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;br&gt;
  &lt;div class="col-sm-6"&gt;
      &lt;div class="form-inline"&gt;
          &lt;input class="form-control input-sm" name="tweight" type="text" id="tweight1"  value="" readonly&gt;
          &lt;button onclick="weighttotal1()"&gt;Weigthing total&lt;/button&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>