javascript - jQuery: Select all elements with a given class, return their product (multiplication result)? -


i have unknown number of values (coming server-side code) contained in spans class num. need product of of these values.

i tried alert(multiply(jquery('.num').val()); no luck. know it's simple, cannot wrap head around it. missing?

a simple procedural version be

var result = 1; $('.num').each(function() { result *= parsefloat($(this).text()); });  console.log(result); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -