[Solved] Calculate one variable based on changing input


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.

solved Calculate one variable based on changing input