What is the problem between js presentation and text () addition?

I use js to print a small account to follow.
this is the event: I sent with click

.
$(".cart_subtotal_"+prod_id).html(newVal*price);

newVal is quantity
price is commodity unit

so it will grow like this (this is a follow-up)

clipboard.png

HTML

clipboard.png

there is no problem with
but now it is time to add all these values cart_subtotal , and then print them elsewhere
how can I add these values at the same time as I click
?
this is what I think of.

var subtotal = parseInt($(".subtotal").text());
    $(".total-price-display").html(subtotal);

(I added subtotal in cart_subtotal)
is unable to execute
thought is dead
what is the function that can achieve this effect?

Mar.22,2021

$('.subtotal') gets a collection

Menu