[Solved] How to make a button in HTML which decrement a variable?
Your function only changes the value of the Stock variable. It doesn’t change the value of document.getElementById(“myText”).innerHTML which only gets changed when you call myFunction (something you never do). You need to: Actually call myFunction when the document loads Call it again whenever you change the variable. let stock = 10; function myFunction() { document.getElementById(“myText”).innerHTML … Read more