Sum up multiple Values from Dynamic Data fields

Hey guys,

I m currently searching for a quick solution of the following fact:

I have a dynamic collection that has a w-dyn-item with a price.
Lets say I have 4 items with a correspondend price each.

Now I want to add jquery to collect the value for earch dyn-element-item.

I was thinking about creating an array or a sum with sth. like this:

…(‘.w-dyn-item #cost1’ ).each → sum it up

Anyone?

Cheers,
Daniel

Ah nevermind, I got it…

var sum=0;
( ‘.w-dyn-item .price’ ).each (
function( index, element ) {
sum += Number($(this).html());
});

1 Like

Hi Daniel,

Could you provide some assistance for me on this? I believe I am trying to do the same thing but cannot get it to work.

I have a list of values that I want to get the sum of and display it on the same page as the values.

Could you list for me exactly what to do? If you need an example, please let me know.

Thanks!

Hi Mike,

sure I can. I am going to answer you as soon as I got out of rehabilitation. (Not at home or office for the next two weeks).

Regards
Daniel

Gesendet mit der WEB.DE iPhone App

Am 11.01.17 um 22:24 schrieb Mike B

1 Like