Calculate a sum from divs and add it to another element

Hi Webflowers!

My question is rather simple, but I’m still learning how to code, so please don’t judge me, haha :sweat_smile:

I have a CMS grid with items in it and a separate div with a “sum: 1” block.

Basically, what I want is:

• Get numbers from amount class — there are multiple blocks with the same class, but different numbers
• Calculate a sum of these numbers
• Add this sum to the sum class — it’s “1” in “sum: 1”

image
image

Thanks for the replies in advance! :partying_face:

Okay, I found the solution! Gonna make a cloneable and tutorial about it relatively soon.

Special thanks to Aziz who helped me with the code :partying_face:

P.S: Not sure if I won’t forget about the post (will make a notification), but if you want to find out about the solution first, then feel free to subscribe to my Telegram channel.