Dom-Events Flashcards
What is the purpose of events and event handling?
Events and event handling allow for certain elements within the HTML doc to be manipulated by user actions while on the webpage.
Are all possible parameters required to use a JavaScript method or function?
No.
What method of element objects lets you set up a function to be called when a specific type of event occurs?
addEventListener
What is a callback function?
A callback function is a function that is passed as an argument of another function. The callback function is executed inside the other one.
What object is passed into an event listener callback when the event fires?
an object with a handleEvent() method, or a JavaScript function
What is the event.target? If you weren’t sure, how would you check? Where could you get more information about it?
even.target is a reference to the object that the event is acting on. You can check by testing the property in the console or read more about it on MDN
What is the difference between these two snippets of code?
element. addEventListener(‘click’, handleClick)
element. addEventListener(‘click’, handleClick())
handleClick in the second line is being called.