everything that happens in a website or in the browser is an event. clinking on links,hovering and pretty much anything is an event. events are the browser's way to tell us that something has happened.
event trigger code. if you click on a button(event) some code in the js file is called (triggered).
we do this because we want the page to feel more interactive and alive.
there are 3 main ways to bind an event:
- HTML event handlers (bad practice)
- traditional DOM event handlers(better has limitations)
- DOM level 2 event listeners (best one of 3)