function weightTotal(){
var total = 0;
$('.weight').each(function(){
total += +$(this).val(); //if it's an empty string +"" == 0
});
$('#grand_total').html( total + "%" );
}
cheers,
- ricardo
On Mar 6, 9:58 pm, shallowman wrote:
> Hello all,
>
> I am trying to add the values
temp is undefined, so you're adding undefined to the first value in
your loop. Set temp = 0;
Also, unless you're planning on using it elsewhere, you don't need to
assign var obj. And, is there any reason you're using
document.getElementById("grand_total").innerHTML instead of $
('grand_total').ht
2 matches
Mail list logo