Events are actions that occur when a user interacts with the page. There are mainly four types of events, such as mouse events, keyboard events, form events and window document events.
While here, 'Click me!' If clicked on, the message 'Hello World' will be displayed in the id element 'myDiv'.
<button type="button" onclick="alert('Hello World!')">Click Me</button>