Event listener

Today’s topic is event listener. The first method that i learned today is addEventListener().

The Event Target method addEventListener() sets up a function that will be called whenever the specified event is delivered to the target.

Here below is a link which helped me to go through addEventListener() method step by step. https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

Here are some ways to add an event listener to an element:

element.addEventListener("click", function(){ alert("Hello World!"); });

An external function can also be referred to:

element.addEventListener("click", myFunction);

function myFunction() {

alert ("Hello World!"); }

The addEventListener() method allows us to add event listeners on any HTML DOM object, like HTML elements:

window.addEventListener("resize", function(){

document.getElementById("id").innerHTML = sometext; });

There is a remove method in case we want to remove a event listener: removeEventListener()

element.removeEventListener("mousemove", myFunction);

Tomorrow ,i will continue with the same topic.

I had time to work on my CV, tried to improve it according to the feedback.

My typing and English lessons are still go on.