looking for some solutions? You are welcome.

SOLVED: How to sum value of every row after press submit button

Mohtadeen Mastoor:

How to sum value of every row after press submit button I need to calculate the total value of td currently code is calculating total table row

function myFunction() {
  var x = document.getElementById("myTable").rows[0].cells.length;
  document.getElementById("demo").innerHTML =  x  ;
}
<html>
<head>
<style>
table, td {
  border: 1px solid black;
}
</style>
</head>
<body>


<table id="myTable">
  <tr>
    <td>52</td>
    <td>52</td>
    <td>12</td>
  </tr>

</table>
<br> 

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>



</body>
</html>


Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent