Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
I have multiplied 2 inputs to show in a 'Totals' box, but it doesn't multiply the other rows.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JaySeanH" data-source="post: 406636" data-attributes="member: 74120"><p>So this is my html for the inputs...</p><p>[CODE]<tr></p><p> <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></p><p> <td><form><input type="text" data-validation="length" data-validation-length="max100" class="dinput" value="{{Details}}" /></form></td></p><p> <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></p><p> <td><form><input readonly id="subsubtotal" name="totalamount" class="sinput txt" value="{{Subtotal}}" /></form></td> </p><p></tr>[/CODE]</p><p>And here is the javascript...</p><p>[CODE] function calculate() {</p><p> var myBox1 = document.getElementById('qid').value;</p><p> var myBox2 = document.getElementById('uid').value;</p><p> var result = document.getElementById('subsubtotal');</p><p> var myResult = myBox1 * myBox2;</p><p> result.value = myResult.toFixed(2);</p><p> }[/CODE]</p><p>This is what I mean when I say it doesnt multiply the following rows...<img src="http://i.picresize.com/images/2017/04/12/RG3C1.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> </p><p>So the code calculates the top rows, however the rows below (are added by clicking the button) and so on do not calculate.</p><p>Would appreciate any help, thanks in advance.</p></blockquote><p></p>
[QUOTE="JaySeanH, post: 406636, member: 74120"] 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>[/CODE] 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); }[/CODE] This is what I mean when I say it doesnt multiply the following rows...[IMG]http://i.picresize.com/images/2017/04/12/RG3C1.png[/IMG] 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. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
I have multiplied 2 inputs to show in a 'Totals' box, but it doesn't multiply the other rows.
Top