Monday, 26 August 2013

Getting sum out of an input array's elements

Getting sum out of an input array's elements

I have multiple rows in a table that look like this.
<tr>
<td>Item 1</td>
<td><input type=TEXT name="item_name[]" /></td>
<td><input type=TEXT name="item_desc[]" /></td>
<td><input type=TEXT name="item_type[]" /></td>
<td><input type=TEXT name="item_price[]" /></td>
<td><input type=TEXT name="item_setup[]" /></td>
<td><input type=TEXT name="item_quant[]" /></td>
</tr>
etc...
Users can dynamically add more rows or delete them.
I'm trying to do the JS part that will display the total sum of all
item_price*item_quant and display it inside of:
<tr><td id=total></td></tr>

No comments:

Post a Comment