Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
608 B
1
Indexable
  <input id="exchange">
  <button type="submit" onclick="calculateTable()">Submit</button>
  <table id="table">
    <tbody>
      <tr>
        <th>1.0</th>
        <th>tbd</th>
      </tr>
      <tr>
        <th>2.0</th>
        <th>tbd</th>
      </tr>
    </tbody>
  </table>
</body>

<script>
  function calculateTable(){
    let exchange = document.getElementById("exchange").value;
    let table = document.getElementById("table");
    for (let i in table.rows) {
      table.rows[i].cells[1].innerHTML = table.rows[i].cells[0].innerHTML * exchange;
    }
      
    }
</script>