Wednesday, March 7, 2018

EventListener

 
The following lets us appreciate how useful the this referent is.
The example illustrates how to add an event listener on the html DOM.


If we create two buttons with the same id, only the first code gets executed. Yet we
can have two EventListerners on the same button with the below code.
Note the presence of the += sign...

There is also an elaborate way to add an EventListener. It is used for
picking up the end of an animation transition ' transitioned', or the end of the
page being loaded with 'onload'.

source: Javascript.info


No comments: