+ 8

What exactly are "Event Listeners" and how do they work (HTML - JS)?

17th Dec 2016, 5:45 PM
TheOtherOne
TheOtherOne - avatar
2 odpowiedzi
+ 1
Event listeners are callbacks functions that you attach to some DOM node and have listen for some event. For example, you might have an event listener that ways for your button to be clicked. You can have multiple event listeners for the same event on the same node which can be very helpful.
17th Dec 2016, 6:32 PM
James Durand
James Durand - avatar
0
Event listener is simply a function that you want to run when some event happens. For example you many want to change the background by clicking on a button. For this, you bind an event listener to that button for "click" event. On click, event listener will run.
3rd Mar 2018, 6:34 AM
Vikash Pal
Vikash Pal - avatar