+ 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
5 Answers
+ 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.
+ 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.
+ 3
Ryan Els hard work... done
0
i need teacher
0
<span> tag is used for coloring a text