I am trying to calculate the sum of all input boxs' value
<input class='total' type='number' name='total[]' readonly>
(which are readonly and whose values are also got from another javascript calculation function).
I have this jsFiddle
I used the following javascript to sum all the values of a readonly input box. It does not seem to work.
var $form = $('#invEntry'),
$sumDisplay = $('#totaldp');
$form.delegate('.total', 'change', function ()
{
var $summands = $form.find('.total');
var sum = 0;
$summands.each(function ()
{
var value = Number($(this).val());
if (!isNaN(value)) sum += value;
});
$sumDisplay.val(sum);
});