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);
});
});