+ 5

Need help on JavaScript EventListener

I want to add an evemtListener to each circle: The circle itself and his neighbours shall toggleColor. Nothing will do it up to now. edit: i used a workaround but i am unhappy with it https://code.sololearn.com/WJ0V8MFY1bQ6/?ref=app

26th Jul 2018, 6:44 PM
Oma Falk
Oma Falk - avatar
5 Respuestas
+ 7
The code is full of errors. Adding an event listener is the least of your problems. You have functions that aren't declared. Functions that aren't called. Functions that don't serve a function. I see you are using P5. One of my favourite JavaScript libraries. My honest advice is to delete all the code and start from the beginning. Start with function setup. Create your canvas etc. Then go to function draw and draw the circles on the canvas. Then decide what you want the circles to do from there.
26th Jul 2018, 8:44 PM
Ryan Els
Ryan Els - avatar
+ 6
Excellent. Now you can slowly add one block of code at a time and test it and make sure it does what it is supposed to do before solving the next problem.
26th Jul 2018, 9:33 PM
Ryan Els
Ryan Els - avatar
+ 3
Ryan Els hard work... done
26th Jul 2018, 9:23 PM
Oma Falk
Oma Falk - avatar
0
i need teacher
7th Sep 2018, 7:13 AM
IrwanRocksyder
IrwanRocksyder - avatar
0
<span> tag is used for coloring a text
7th Sep 2018, 6:21 PM
BïłÃĺ ĀfžâŁ
BïłÃĺ ĀfžâŁ - avatar