[Solved] Calculate one variable based on changing input

[ad_1]

Your code is almost correct – you are showing the result in the BetAmount field so no change is visible.

Change your code to:

document.getElementById("PotentialGain").value = ish;

Here’s a working demo. I changed the event to onkeyup as onchange only happens on blur – i.e. when a field loses focus.

[ad_2]

solved Calculate one variable based on changing input