JS What's the difference between x.onclick and x.addEventListener() ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

JS What's the difference between x.onclick and x.addEventListener() ?

I was just working on a code and in the js, I had x.onclick, but didn't work. But it worked when I did it through addEventListener(). So what really is the difference ?

1st Aug 2019, 5:01 AM
Ginfio
Ginfio - avatar
1 Answer
+ 4
1st Aug 2019, 5:51 AM
Gordon
Gordon - avatar