Multiple var addition not updating properly
Hello.
Sorry the code example might be a little long but it's repetitive and should be easy to understand.
http://jsbin.com/eyeke4/13/edit
My real code has 12 examples and not 3 but for the sake of this I had to shorten it as much as possible.
When you go on there and preview it, you Select a level, then select a hero, then select 3 items and hit click me. This will give you a result of statistics. Now my problem is all the way on the right you will see all 3 values of AP are added together. In the last column alone. The thing about it is if you change item #1 and item #2 it does not update properly..to update it you MUST change the last item each time, which is inconvenient.
The way it works is :
daap1 = iap1[isi1];
daap2 = iap2[isi2];
daap3 = iap3[isi3];
totalap = (daap1 + daap2 + daap3);
$(".tap").html(totalap);
Pretty much like this in a nutshell. if I were to put $(".tap").html((iap1[isi1] + iap2[isi2] + iap3[isi3])); it works perfectly fine. But I need to use the variable totalap in formulas. How do I make it so things always update properly without the user having to do inconvenient things like always having to reselect the last dropdown? In my main code I have 12 total, 6 and 6 split apart, for me to currently get accurate info I must reselect the 6th and 12th item every single time. Any help on how I could achieve this would be very much appreciated, do I need a database or something? I don't mind what I need as long as it would work perfectly. Thanks in advance.