+ 3
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
7 Réponses
+ 4
https://www.codeproject.com/Questions/469411/using-document-onclick-overrides-other-onclick-eve
+ 3
Leia Bishop ahh okay
Check this maybe will help you
https://stackoverflow.com/questions/2629916/how-do-you-override-inline-onclick-event
+ 3
+ 2
Leia Bishop You global variables for pos and box.
Declare those before function definition..
Local variables defining new one every time you click on..
+ 1
Leia Bishop first you need a right function, which the same as left and u just use pos+=1 instead of pos-=1
+ 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
+ 1
You're welcome..