adding numeric values of variable number of forms
Posted
by user306472
on Stack Overflow
See other posts from Stack Overflow
or by user306472
Published on 2010-04-06T05:17:56Z
Indexed on
2010/04/06
5:23 UTC
Read the original article
Hit count: 256
I'm trying to use jquery to loop through a block of forms that contain numeric data and add it all up to be displayed in a form with id grand. I have the ability to dynamically add new forms, so the number of forms I'm looping through will change. Here's my jquery code I wrote that isn't working for whatever reason:
$('#table').delegate('input#grand', 'focus', function(){
var grand = $(input.expend).map(function(){
return this.value;
});
$(grand).each(function(){
var g = 0;
g+= $(this);
$('input#grand').val(g);
});
});
© Stack Overflow or respective owner