Here is a little handy piece of code I wrote that greatly simplifies summing values across a bunch of text inputs on your page, all you have to do is stick a class on the inputs you want to sum, in my case the class was ‘budget’ and voila, you will have the sum without having to do a bunch of this + that.
1 | var budgetTotal = 0; |
2 | $( '.budget' ).each( function (e, s) { |
3 | budgetTotal += parseFloat($(s).val()); |
4 | }); |