Hi.
I am trying to create a simple function that updates a divs innerHTML based on a sum I am pulling from a CMS collection.
It is currently set up like so:
<script>
const items = document.getElementsByClassName("amount-count");
let sum = 0;
for (item of items) {
sum += parseInt(item.innerHTML);
}
const total = document.getElementsByClassName("amount-total");
total.innerHTML = "$" + sum;
</script>
If I console log “total”, I get what I’m looking for. But the page itself is not displaying the information at all.
Here is my site Read-Only: https://preview.webflow.com/preview/cpr-mro?utm_medium=preview_link&utm_source=dashboard&utm_content=cpr-mro&preview=fce14146ce8e01608eb83a0e87920a17&workflow=preview
Look for consumer > dashboard