JaySeanH
New Member
- Feb 6, 2017
- 19
- 2
So this is my html for the inputs...
And here is the javascript...
This is what I mean when I say it doesnt multiply the following rows...
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.
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>
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);
}
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.