I know the answer is probably really obvious, but I’m having a complete brain fart here.
What I want to do is have a simple form with two buttons. The first button shows a message saying “1”. After clicking the second button, the first button says “2” when clicked. After clicking the second button again, it goes back to saying “1”.
Having learned programming with javascript, I’m still thinking in javascript. My first train of thought was:
myButton.onclick=…
After that the only thing I could think of was to have a conditional inside the first button’s click function and use the second button’s click to change a boolean…
Is there a better way to do this?
I understood, what happens when one click the button2 first time and for the second time. But if you want to say that its the pattern it has to follow, then:
Populate the method with whatever you are looking for. In this, These methods can be reused for button1 click event also.
Hope it helps.