1. Mouse Events

EventDescription
onClickFires when an element is clicked.
onDoubleClickFires when an element is double-clicked.
onMouseDownFires when the mouse button is pressed down.
onMouseUpFires when the mouse button is released.
onMouseMoveFires when the mouse moves over an element.
onMouseEnterFires when the mouse enters an element (doesn’t bubble).
onMouseLeaveFires when the mouse leaves an element (doesn’t bubble).
onMouseOverFires when the mouse enters an element or its children.
onMouseOutFires when the mouse leaves an element or its children.

2. Keyboard Events

EventDescription
onKeyDownFires when a key is pressed down.
onKeyPress (Deprecated)Fires when a key is pressed (use onKeyDown instead).
onKeyUpFires when a key is released.

3. Form Events

EventDescription
onChangeFires when the value of an input, textarea, or select changes.
onInputFires when the user inputs text.
onSubmitFires when a form is submitted.
onResetFires when a form is reset.
onFocusFires when an element gains focus.
onBlurFires when an element loses focus.

4. Clipboard Events

EventDescription
onCopyFires when the user copies content.
onCutFires when the user cuts content.
onPasteFires when the user pastes content.

5. Drag & Drop Events

EventDescription
onDragFires when an element is being dragged.
onDragStartFires when the drag starts.
onDragEndFires when the drag ends.
onDragOverFires when an element is dragged over a valid drop target.
onDragEnterFires when the dragged element enters a valid drop target.
onDragLeaveFires when the dragged element leaves a valid drop target.
onDropFires when a dragged element is dropped.

6. Touch Events (Mobile)

EventDescription
onTouchStartFires when a touch point is placed on the screen.
onTouchMoveFires when a touch point moves on the screen.
onTouchEndFires when a touch point is removed from the screen.
onTouchCancelFires when a touch event is canceled.

7. Focus Events

EventDescription
onFocusFires when an element gains focus.
onBlurFires when an element loses focus.

8. Window & Document Events

EventDescription
onLoadFires when a page has loaded.
onUnloadFires when a page is unloaded or refreshed.
onResizeFires when the window is resized.
onScrollFires when the user scrolls the page.
onBeforeUnloadFires before the user leaves the page (for warnings).

9. Media Events

EventDescription
onPlayFires when media starts playing.
onPauseFires when media is paused.
onEndedFires when media reaches the end.
onTimeUpdateFires when media time updates.
onVolumeChangeFires when volume changes.

10. Animation & Transition Events

EventDescription
onAnimationStartFires when a CSS animation starts.
onAnimationEndFires when a CSS animation ends.
onAnimationIterationFires when a CSS animation repeats.
onTransitionEndFires when a CSS transition ends.

React-Specific Synthetic Events

React wraps native DOM events with Synthetic Events for performance optimizations. These events work the same as native events but provide cross-browser consistency.

  • SyntheticEvent is a wrapper around native events.
  • React events use camelCase (onClick instead of onclick).
  • React handles events asynchronously for optimization.

Example: Using Events in React


import { useState } from "react";

function EventExample() {
  const [text, setText] = useState("");

  const handleClick = () => {
    alert("Button clicked!");
  };

  const handleChange = (event) => {
    setText(event.target.value);
  };

  return (
    
); } export default EventExample;

Common JavaScript & React Events

🔥 JavaScript Events

  • onclick - Triggered when an element is clicked.
  • onmouseover - Fires when the mouse hovers over an element.
  • onmouseout - Fires when the mouse leaves an element.
  • onkeydown - Triggered when a key is pressed down.
  • onkeyup - Fires when a key is released.
  • onchange - Occurs when an input value changes.
  • onsubmit - Triggered when a form is submitted.
  • onload - Fires when a page or resource has loaded.
  • onresize - Occurs when the browser window is resized.

⚛️ React-Specific Events

  • onClick - Handles click events in React.
  • onMouseEnter - Triggers when the mouse enters an element.
  • onMouseLeave - Triggers when the mouse leaves an element.
  • onChange - Used for handling input field changes.
  • onSubmit - Handles form submissions.
  • onKeyDown - Fires when a key is pressed.
  • onKeyUp - Fires when a key is released.
  • onFocus - Triggered when an element gains focus.
  • onBlur - Triggered when an element loses focus.
  • onDoubleClick - Fires when an element is double-clicked.
  • onContextMenu - Fires when a right-click context menu is opened.

JavaScript but mostly React Event because of Camel Case

Below is a list of common events used in JavaScript and React:

1. Mouse Events

EventDescription
onClickFires when an element is clicked.
onDoubleClickFires when an element is double-clicked.
onMouseDownFires when the mouse button is pressed down.
onMouseUpFires when the mouse button is released.
onMouseMoveFires when the mouse moves over an element.
onMouseEnterFires when the mouse enters an element (doesn't bubble).
onMouseLeaveFires when the mouse leaves an element (doesn't bubble).
onMouseOverFires when the mouse enters an element or its children.
onMouseOutFires when the mouse leaves an element or its children.

2. Keyboard Events

EventDescription
onKeyDownFires when a key is pressed down.
onKeyPress (Deprecated)Fires when a key is pressed (use onKeyDown instead).
onKeyUpFires when a key is released.

3. Form Events

EventDescription
onChangeFires when the value of an input, textarea, or select changes.
onInputFires when the user inputs text.
onSubmitFires when a form is submitted.
onResetFires when a form is reset.
onFocusFires when an element gains focus.
onBlurFires when an element loses focus.

4. Clipboard Events

EventDescription
onCopyFires when the user copies content.
onCutFires when the user cuts content.
onPasteFires when the user pastes content.

5. Drag & Drop Events

EventDescription
onDragFires when an element is being dragged.
onDragStartFires when the drag starts.
onDragEndFires when the drag ends.
onDragOverFires when an element is dragged over a valid drop target.
onDragEnterFires when the dragged element enters a valid drop target.
onDragLeaveFires when the dragged element leaves a valid drop target.
onDropFires when a dragged element is dropped.

6. Window & Document Events

EventDescription
onLoadFires when a page has loaded.
onUnloadFires when a page is unloaded or refreshed.
onResizeFires when the window is resized.
onScrollFires when the user scrolls the page.
onBeforeUnloadFires before the user leaves the page (for warnings).

7. Animation & Transition Events

EventDescription
onAnimationStartFires when a CSS animation starts.
onAnimationEndFires when a CSS animation ends.
onAnimationIterationFires when a CSS animation repeats.
onTransitionEndFires when a CSS transition ends.

Learn how we helped 100 top brands gain success