Quiz: Handling Events

Try this self-check quiz to test your knowledge!

What can we attach to DOM elements in order to respond to events in the system?

Event Handlers Event Listeners Event Processors Event Coordinators We create Event Listeners, which are attached to DOM elements and respond to specific event signals dispatched to the system.

What method do we use to create an event listener?

element.makeEventListener() element.listen() element.on() element.addEventListener() The command element.addEventListener() is the preferred method for creating a new event listener.

The following example uses what type of function to handle an event?

element.addEventListener('click', function(event){});

named function anonymous function inline function arrow function This example uses an anonymous function.

What property on the event object contains the DOM object that invoked the event?

event.element event.source event.target event.invoker The event.target property is a reference to the DOM object that invoked the event.

Why is the event.preventDefault() command used?

To prevent the setting of default data values in the database. To prevent the execution of default actions in response to an event trigger. To enforce the submission of a form. To stop execution of all code. The event.preventDefault() command prevents the execution of default actions in response to an event trigger or signal.

Which event trigger indicates the DOM has finished loading and processing?

DOMContentLoaded DOMReady DOMFinished DocumentReady The DOMContentLoaded event is dispatched when the HTML has been downloaded and the DOM has been processed.

Visit Quiz Online

The quiz on this page has been removed from your PDF or ebook format. You may take the quiz by visiting this book online.

results matching ""

    No results matching ""