Advertisement
ilianrusev

Untitled

Jan 17th, 2022
24
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sumTable() {
  2. let rows = document.querySelectorAll("table tr");
  3. let sum = 0;
  4. for (let i = 1; i < rows.length; i++) {
  5. let current = rows[i].lastElementChild
  6.  
  7. sum += Number(current.textContent);
  8. }
  9. document.getElementById("sum").textContent = sum;
  10.  
  11. }
Advertisement
RAW Paste Data Copied
Advertisement