4R - DOM Custom Events

Define/Explain DOM Custom Events

There are numerous amounts of custom events that are used in almost every web application. DOM Custom Events are events that happen when a user clicks on something.

Define/Explain How to Create Custom Events

Custom events are created using the CustomEvent constructor. To create a custom event we use the Event constructor or CustomEvent interface. The Event constructor creates an Event and CustomEvent creates an Event with more functionality.

Explain Why DOM Custom Events Are Used

Custom events allow us to run the function outside of the script. This provides users more flexibility in developing the code and also improves maintenance of the code.

Summary of the Documentation

Custom events allow you to create events outside of the events that are available by default allowing you to create them to your needs.