I am trying to add a function to multiple <td> without having to actually write so many times addEventListener. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

I am trying to add a function to multiple <td> without having to actually write so many times addEventListener.

So I have the code below. I wrote in js some comments telling what is wrong and what I wanted to do. What is the best way to do that? https://code.sololearn.com/WPBLpTQ9I6H7/?ref=app

14th Sep 2019, 6:50 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
3 Answers
14th Sep 2019, 9:49 PM
ODLNT
ODLNT - avatar
+ 3
Alex Tusinean My apologies for the delay response. I refactored the code in question I believe it makes the code easier to follow. If not let me know. https://code.sololearn.com/WUaiNiQmAP6n/#js
15th Sep 2019, 6:28 PM
ODLNT
ODLNT - avatar
+ 2
ODLNT can you please explain this code a little more? https://code.sololearn.com/WHu19OeFHd2l/?ref=app
15th Sep 2019, 7:30 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar