Welcome to the 30th Easy JavaScript tutorial, part of EasyProgramming.net. We've already looked at even handlers, this tutorial will give you a brief intro to event listeners.
An event listener is a method that looks for an event on a target. Works very similarly to the event handler, but has a slightly different syntax and allows you to listen for more than one event on a target whereas event handlers will only allow you to do one!
This tutorial only covers the "click" event listeners. Watch the 31st tuturial to see how the rest of them are done.
element.addEventListener("event",function(){ //do something when the event takes place });
Let's learn!
To fork the fiddle and follow along: https://jsfiddle.net/easyjs/ksbvkfwh/
Remember to checkout the Resources section below for associated downloadable content, JSFiddle links, and other resources. Watch the video and follow along!