I have a code cannot get inner foreach total sum
<script>
const opSelect = document.querySelectorAll('.op .qltbox');
opSelect.forEach(opSelect => {
const a = opSelect.querySelector('input[type=text]');
a.onchange = function() {
const numTot = parseInt(a.value);
const itemTot = 0;
numTot.forEach(eachItem => {
itemTot += itemTot;
});
};
});
</script>
the second foreach is no function
question from:https://stackoverflow.com/questions/65557467/how-to-get-change-total-sum-foreach