Event-driven programming is a programming paradigm in which the flow of the program is determined by events such as user input, sensor output, or messages from other programs or threads.
In event-driven programming, an event handler is a function that is invoked in response to an event. Event handlers are often registered with an event listener, which is an object that detects events and invokes the registered event handlers in response.
When using DOM objects for event handling, it is important to keep in mind that not all browsers generate the same events or invoke event handlers in the same order. Therefore, it is important to test your code in different browsers before deploying it.