Note that there are some explanatory texts on larger screens.

plurals
  1. POhow do i add or increase a numeric value in an input text field?
    text
    copied!<p>i'm using this jquery calculation plugin: <a href="http://www.pengoworks.com/workshop/jquery/calculation/calculation.plugin.htm" rel="nofollow">http://www.pengoworks.com/workshop/jquery/calculation/calculation.plugin.htm</a></p> <p>i'm using the sum example.</p> <p>in my version, i'm dynamically inserting values into fields and recalculating and all works well, but so far i have just been inserting new values into empty fields.</p> <p>now in a separate action i want to increase the value of one of the fields that has been previously filled by a value and then recalculate again.</p> <p>i setup a fiddle with what i'm trying to do.</p> <p><a href="http://jsfiddle.net/rEQnY/1/" rel="nofollow">http://jsfiddle.net/rEQnY/1/</a></p> <p>there's a dropdown with options. each option has a numeric value.</p> <p>now as an example lets just pick a field at random. lets say that 3rd field that has a number "1" in it.</p> <p>when i select one of the dropdown values, i want that 3rd field with a number 1 in it to increase by that much, and then the total sum box should also increase by that much.</p> <p>in the javascript i started with listening to a change in the dropdown box, but what do i insert in between there?</p> <p>maybe i can grab the selected value like this:</p> <pre><code>$('#numbers').val(); </code></pre> <p>but then how do i add it to the other field?</p> <p>update:</p> <p>how do i fix this new version?</p> <p><a href="http://jsfiddle.net/rEQnY/8/" rel="nofollow">http://jsfiddle.net/rEQnY/8/</a></p> <p>i want 2 different fields to add value to another field.</p> <p>if dropdown 1 (by itself) adds 2 to 3rd input text box, 3rd input text box should become 3.</p> <p>if dropdown 2 (by itself) adds 2 to 3rd input text box, 3rd input text box should become 3.</p> <p>if 2 is selected in both dropdowns, then 4 should be added to 3rd input text box and become 5.</p> <p>if either dropdown 1 or dropdown 2 is reset, meaning "pick one" is selected, then the 3rd input text box should be subtracted by 2, making it 3.</p> <p>as you can see in my example, only one dropdown adds to the field. can be either or, but not both. i want both to be able to add to it and take away from it when the default "pick one" is selected.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload