Events
In JavaScript, events are actions or occurrences that happen in the browser—such as a user clicking a button, pressing a key, or a web page finishing loading—which the browser signals so your code can react to them.
They are the foundation of interactive and dynamic web development.
Common Types of Events
- click: Fires when an element is clicked.
- submit: Fires when a form is submitted.
- keydown: Fires when a keyboard key is pressed.
- keyup: Fires when a keyboard key is released.
- change: Fires when an input element's value changes.
- mouseover: Fires when a pointer moves onto an element.
- mouseout: Fires when a pointer leaves an element.
- DOMContentLoaded: Fires when the HTML document is fully loaded.
