D
D
Dmitry2021-07-07 12:35:55
JavaScript
Dmitry, 2021-07-07 12:35:55

How to subtract the sum of the contents of these three blocks?

Need to know the sum of all the numbers from the blocks, how can I do this in jQuery?
The content of subtotal_price will change

https://codepen.io/WafelT/pen/abWNwMQ

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DivineDraft, 2021-07-07
@WafelT

Sum of numbers from blocks

A
Andrew, 2021-07-07
@wug1

let sum = 0;
$('.subtotal__price').each(function(){
sum += +$(this).html();
});
console.log('summ',sum);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question