sum int array values
we will loop to sum all values :
if we have an array like
if we have an array like
<ul>
<li class='price'>10</li>
<li class='price'>5</li>
<li class='price'>3</li>
<li class='price'>11</li>
</ul>
summ will get by :
$('.price').blur(function () {
var sum = 0;
$('.price').each(function() {
sum += Number($(this).html());
});
});
Comments
Post a Comment