Listening to Events

giandodev

GiandoDev

Posted on April 24, 2020

Listening to Events

The events allow us to listen for something inside our D.O.M.
Here is the list of all avaible events (MDN)
that we can listen to.
Alt Text
In the gif down below we see the snippet of code in action.
When the button is clicked the addEventListener perform the action, in this case we add or remove the class red to our button (element).
Alt Text
There is also the event object but we talk about it later and more in depth.

💖 💪 🙅 🚩
giandodev
GiandoDev

Posted on April 24, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related