Complete JavaScript Events List with Practical Examples

Bobby Jul 13, 2026

Events are a fundamental part of JavaScript, enabling interactions and functionality with the Document Object Model (DOM) in web development. They are reactions to specific actions: clicks, key presses, mouse movements, and so on. Let's delve into an extensive list of JavaScript events, complete with examples to illustrate their practical use.

JavaScript Event Types that to Enhance Your Page's Response & User-friendliness
JavaScript Event Types that to Enhance Your Page's Response & User-friendliness

Events form the backbone of interactive web applications. They can trigger functions, change values, and even manipulate the DOM. Familiarizing yourself with JavaScript events is therefore crucial for any web developer. Let's start with the basics and gradually move to more complex events.

JavaScript Event Handler vs. Event Listener: What’s the Difference? 🎯
JavaScript Event Handler vs. Event Listener: What’s the Difference? 🎯

Commonly Used JavaScript Events

These events are the bread and butter of web development. They are often used in simple and complex projects alike.

Events in JavaScript
Events in JavaScript

Let's kick off with the most common event: the click event. It occurs when the user clicks an element.

click

A Simple Explanation of Event Delegation in JavaScript
A Simple Explanation of Event Delegation in JavaScript

The click event triggers a function when an element is clicked:

<button onclick="alert('Button clicked!')">Click me</button>

keydown and keyup

JavaScript Form Events: Handle User Input Like a Pro πŸ“
JavaScript Form Events: Handle User Input Like a Pro πŸ“

The keydown and keyup events occur when a user presses or releases a key on their keyboard:

<input type="text" id="myInput"></input>

JavaScript: <script> document.getElementById('myInput').addEventListener('keydown', function(event) { document.body.innerHTML += 'Key down: ' + event.key + '
'; }); document.getElementById('myInput').addEventListener('keyup', function(event) { document.body.innerHTML += 'Key up: ' + event.key + '
'; }); </script>

Click Events in JavaScript
Click Events in JavaScript

Mouse Events with addEventListener()

We're referring to events like dblclick, mousemove, and mouseenter. Using addEventListener(), we can attach multiple event handlers to the same element:

DOM & Events
DOM & Events
How to Make Custom Event Listeners in JavaScript
How to Make Custom Event Listeners in JavaScript
JavaScript Event Object: Unlock the Power of Event Handling πŸš€
JavaScript Event Object: Unlock the Power of Event Handling πŸš€
JavaScript Window Events: Control Browser Behavior Like a Pro 🌍
JavaScript Window Events: Control Browser Behavior Like a Pro 🌍
Input Events
Input Events
JavaScript Animation Events: Control CSS Animations Like a Pro 🎬✨
JavaScript Animation Events: Control CSS Animations Like a Pro 🎬✨
a flyer for an upcoming event with information about the date and time in each section
a flyer for an upcoming event with information about the date and time in each section
JavaScript Media & Network Events: Control Audio, Video, and Connectivity πŸŽ₯πŸ“‘
JavaScript Media & Network Events: Control Audio, Video, and Connectivity πŸŽ₯πŸ“‘
10 JavaScript Concepts Every Beginner Must Know (Save This Cheat Sheet!)
10 JavaScript Concepts Every Beginner Must Know (Save This Cheat Sheet!)
Mouse Events
Mouse Events
Event Listeners
Event Listeners
⏳ Master JavaScript setTimeout(): Delay Code Execution Like a Pro! πŸ’»βœ¨  Pin Description:
⏳ Master JavaScript setTimeout(): Delay Code Execution Like a Pro! πŸ’»βœ¨ Pin Description:
JavaScript array methods
JavaScript array methods
Coding - JavaScript Mouse Events πŸ”₯  #javascript | Facebook
Coding - JavaScript Mouse Events πŸ”₯ #javascript | Facebook
JavaScript Basics You MUST Know
JavaScript Basics You MUST Know
JavaScript Cheat Sheet You Must Save | Beginner Friendly Guide
JavaScript Cheat Sheet You Must Save | Beginner Friendly Guide
Javascript Fundamental
Javascript Fundamental
JavaScript Cheatsheet for Beginners | Learn JS Fast (One-Page Guide)
JavaScript Cheatsheet for Beginners | Learn JS Fast (One-Page Guide)
an info sheet with different types of web pages
an info sheet with different types of web pages
JavaScript Full Notes Every Beginner Must Save πŸ’‘
JavaScript Full Notes Every Beginner Must Save πŸ’‘

<div id="myDiv"> Hover over me</div>

JavaScript: <script> document.getElementById('myDiv').addEventListener('mouseenter', function() { alert('Mouse entered the div!'); }); document.getElementById('myDiv').addEventListener('mouseleave', function() { alert('Mouse left the div!'); }); </script>

mousewheel

This event fires when the mouse wheel is scrolled. Here's a simple example:

JavaScript: <script> document.body.addEventListener('mousewheel', function(event) { document.body.innerHTML += 'Wheel delta: ' + event.deltaY + '
'; }); </script>

blob:anguard

This event is fired when a paste actions occurs. It can be useful for tracking user behavior:

JavaScript: <script> document.addEventListener('paste', function(event) { console.log(event.clipboardData.getData('text/plain')); }); </script>

Form Submission Events

Form events are crucial for managing user input and validation:

submit

The submit event occurs when a form is submitted:

<form id="myForm"> ... </form>

JavaScript: <script> document.getElementById('myForm').addEventListener('submit', function(event) { event.preventDefault(); // prevent the default form submission alert('Form submission prevented!'); }); </script>

JavaScript events are vital and numerous, offering a plethora of possibilities for enhancing user interaction and creating dynamic web applications. From simple alerts to complex animations and calculations, they form the backbone of JavaScript's interactivity. Don't shy away from experimenting and exploring the various events and their behaviors to unlock the full potential of JavaScript!