I have multiplied 2 inputs to show in a 'Totals' box, but it doesn't multiply the other rows.

JaySeanH

New Member
Feb 6, 2017
19
2
So this is my html for the inputs...
Code:
<tr>
    <td><form><input type="number" oninput="calculate()" id="qid" data-quantity name="qamount"  min="0" data-validation="number" class="qinput txt" value="{{Quantity}}" /></form></td>
    <td><form><input type="text" data-validation="length" data-validation-length="max100" class="dinput" value="{{Details}}" /></form></td>
    <td><form><input type="number" oninput="calculate()" id="uid" data-unitprice name="uamount" min="0" data-validation="number" data-validation-allowing="float" class="uinput txt" value="{{UnitPrice}}" /></form></td>
    <td><form><input readonly id="subsubtotal" name="totalamount" class="sinput txt" value="{{Subtotal}}" /></form></td>  
</tr>
And here is the javascript...
Code:
 function calculate() {
        var myBox1 = document.getElementById('qid').value;
        var myBox2 = document.getElementById('uid').value;
        var result = document.getElementById('subsubtotal');
        var myResult = myBox1 * myBox2;
        result.value = myResult.toFixed(2);
    }
This is what I mean when I say it doesnt multiply the following rows...
RG3C1.png

So the code calculates the top rows, however the rows below (are added by clicking the button) and so on do not calculate.
Would appreciate any help, thanks in advance.
 

Users who are viewing this thread

Top