How I can sum up the values filled in unitprice array using javascript
Here is my html.
<td>
<input type="text" style="width: 60px; background: none repeat scroll 0% 0% rgb(255, 255, 255);" maxlength="4" id="unitprice" name="unitprice[]">
</td>
<td>
<input type="text" style="width: 60px; background: none repeat scroll 0% 0% rgb(255, 255, 255);" maxlength="4" id="unitprice" name="unitprice[]">
</td>
Change your HTML to use
classinstead ofid(idmust be unique):Then you can total via JavaScript (using jQuery
.each()function):