Skip to main content

Common Events List for addEventListener

Mouse Events​

EventDescription
clickWhen the user clicks
dblclickDouble click
mouseoverWhen the cursor enters an element
mouseoutWhen the cursor leaves the element
mousemoveWhen the cursor moves over an element
mousedownWhen a mouse button is pressed
mouseupWhen a mouse button is released
contextmenuRight mouse click

Keyboard Events​

EventDescription
keydownWhen a key is pressed
keyupWhen a key is released
keypress(Deprecated, use keydown)

Form Events​

EventDescription
submitWhen a form is submitted
changeWhen the value of an input/select changes
inputWhen typing (while typing)
focusWhen an input receives focus
blurWhen an input loses focus
resetWhen a form is reset

πŸ“„ Document or Window Events​

EventDescription
loadWhen the page has finished loading
DOMContentLoadedWhen the DOM is ready (before images)
resizeWhen the browser window changes size
scrollWhen scrolling
beforeunloadBefore the user closes or reloads the page
unloadWhen the page is closed

Device Events (touch/screen)​

EventDescription
touchstartWhen an element is touched
touchmoveWhen the finger moves on the screen
touchendWhen the finger is lifted
orientationchangeDevice orientation change

Basic Example​

const button = document.getElementById('myButton');

button.addEventListener('click', () => {
alert('Button clicked!');
});