I'm struggling with a code that is not calculating the total sum properly within an inner foreach loop
<script>
const opSelect = document.querySelectorAll('.op .qltbox');
opSelect.forEach(op => {
const inputElement = op.querySelector('input[type=text]');
inputElement.onchange = function() {
const numTotal = parseInt(inputElement.value);
let itemTotal = 0;
// Error occurs in this second forEach loop
numTotal.forEach(eachItem => {
itemTotal += eachItem;
});
};
});
</script>
The issue seems to lie in the functionality of the second foreach loop