fullstack_webdev

Code and notes from Full stack web developer path, LinkedIn Learning.

View on GitHub

09. Events

09_01 Events in programming


09_02 Typical DOM Events


09_03 Event Listeners

const button = document.querySelector("button");
// In this example we have an EventListener appended to a button. When the button is clicked we log an event in the console.
button.addEventListener("click", (e) => {
  // listening for click event, with a callback that captures the event e and console logs it.
  console.log(`Event fired: ${e}`);
});

09_04 Practice: Experiment with Event Listeners


09_05 Advanced Event listeners and “this”