Actions that take place in a DOM are called events. An example of an event is a button click. Basically, any this that a page does, either on its own or by the user’s request is an event.
html...
JaveScript...
We grab the button from the DOM using the id (we could have used querySelector here also). We then store it in a variable. We can then call the DOM method entitled, “addEventListener” to it. This has the DOM element listen for events we specify. In this example, the button is listening for when the user clicks it.
We can put these event interactions together with DOM manipulation to provide functionality for the end user. For example…