How do I get one onclick event to override another?
Please can someone help me, I'm trying to make the circle move the direction of whichever arrow key is clicked but if you hit up then right, it does both and I want it to cancel out the other buttons.. Also Idk how to make the object stay in its new position rather than go back to the middle if anyone can help me with that too 🙏 Please explain like I'm 5, my knowledge is basic 😂 https://code.sololearn.com/WBitrfPnaFpf/?ref=app https://code.sololearn.com/WBitrfPnaFpf/?ref=app
Leia Bishop ahh okay Check this maybe will help you https://stackoverflow.com/questions/2629916/how-do-you-override-inline-onclick-event
Bhargava Ram Ai.dz Jayakrishna🇮🇳 thank you all that is very helpful I think I get it now ❤️
Leia Bishop You global variables for pos and box. Declare those before function definition.. Local variables defining new one every time you click on..
Leia Bishop first you need a right function, which the same as left and u just use pos+=1 instead of pos-=1
Ai.dz i didn't get as far as to write the last two buttons because I couldn't get left to override up