DEV Community

Cover image for Listening to Events
GiandoDev
GiandoDev

Posted on

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.

Discussion (0)