The process of event processing in JS is divided into three steps:
1. Event Occurrence
2. Start the event handler
3. Event handlers react
Invocation of the event handler
1. In JavaScript
To invoke an event handler in JavaScript, first obtain a reference to the object to be processed, and then assign the handler function to be executed to the corresponding event
2. In HTML
To assign an event handler in HTML, simply add the appropriate event in the HTML tag and specify the code or function name you want to execute
DOM Event Model:
The DOM structure is a tree structure, and when an HTML element produces an event, the event propagates through the path of the element node directly to the root node, and the node that passes through the path receives the event, which can be called the DOM event stream
Event and event handling in JavaScript