Why is this code not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is this code not working?

I can't draw and I'm also getting a error. Please fix the code https://code.sololearn.com/W6ZnJJt5nudz/?ref=app

30th Jun 2020, 2:50 PM
Sajid
Sajid - avatar
17 Answers
+ 1
https://code.sololearn.com/W9tbCLFkno47/?ref=app
1st Jul 2020, 12:31 PM
Gordon
Gordon - avatar
+ 3
What tech stack are you using to build Android app?
2nd Jul 2020, 12:53 AM
Gordon
Gordon - avatar
+ 2
arieh thanks. But still I can't draw. Can you help?
30th Jun 2020, 6:29 PM
Sajid
Sajid - avatar
+ 2
arieh 😔 its ok. Thanks
30th Jun 2020, 10:47 PM
Sajid
Sajid - avatar
+ 1
Gordon still can't fix it. Help please.
30th Jun 2020, 4:36 PM
Sajid
Sajid - avatar
+ 1
Sajid this fix it. Add window.onload = function(){ in the beggining and } in the end
30th Jun 2020, 5:31 PM
arieh
+ 1
arieh i want to hold my on the screen and keep drawing wherever my finger goes. Don't these events work on mobile devices?
30th Jun 2020, 6:54 PM
Sajid
Sajid - avatar
+ 1
I don't know how to fix that. Sorry...
30th Jun 2020, 7:06 PM
arieh
0
I have change the event 'mousedown' to 'click' and it works for me. But i don't know if that is what you want...
30th Jun 2020, 6:47 PM
arieh
0
If you are testing on a mobile device The event listeners are touchstart touchmove touchcancel touchend
1st Jul 2020, 3:31 AM
Gordon
Gordon - avatar
0
Gordon so mouse events don't work on touch screen devices?
1st Jul 2020, 8:06 AM
Sajid
Sajid - avatar
0
except click
1st Jul 2020, 8:24 AM
Gordon
Gordon - avatar
0
Gordon I tried to do what you were telling me but still not working. By the way, the code is from mdn.
1st Jul 2020, 8:26 AM
Sajid
Sajid - avatar
0
Gordon thanks man. Could you please tell me if there is a way on android to click something while holding shift key? I'm not being able to do that. shiftKey always has a value of false
2nd Jul 2020, 12:44 AM
Sajid
Sajid - avatar
0
Gordon I'm building websites.
2nd Jul 2020, 8:41 AM
Sajid
Sajid - avatar
0
You used const as a variable type. I thibk you should change it to var
2nd Jul 2020, 3:25 PM
Sali65
Sali65 - avatar