I'm trying to use an array of input values to do a live sum of the values.
Here is the example:
SUM <input id="proyected_analysis_expense_1" name="proyected_analysis_expense[name][]" type="text" value="">
<script type="text/javascript">
jQuery("#proyected_category_expense_1").live("change", function(){
pce1_value = parseFloat(jQuery("#proyected_category_expense_1").val());
total = pce1_value ;
jQuery("#proyected_analysis_expense_1").val(total.toFixed(2));
});
</script>
FIELD1: <input id="proyected_category_expense_1" name="flow_budget[flow_budget_details_attributes][1][amount]" type="text" value=""></td></tr>
Here is the live demo

The problem is that the sum is not working on the demo
I want this using dynamic information
<script type="text/javascript">
jQuery("#proyected_category_expense_1").live("change", function(){
pce1_value = parseFloat(jQuery("#proyected_category_expense_1").val());
pce2_value = parseFloat(jQuery("#proyected_category_expense_2").val());
pce3_value = parseFloat(jQuery("#proyected_category_expense_3").val());
.... ///this will continue without type
total = pce1_value + pce2_value + .... ; ///this will continue without type
jQuery("#proyected_analysis_expense_1").val(total.toFixed(2));
jQuery("#proyected_analysis_expense_2").val(total.toFixed(2));
.... ///this will continue without type
});
</script>
Please somebody can help me how to do the sum in input arrays?