GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — EventTarget: dispatchEvent() method - Web APIs | MDN

EventTarget: dispatchEvent() method

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

  • See full compatibility
  • Learn more

Note: This feature is available in Web Workers.

The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

Calling dispatchEvent() is the last step to firing an event. The event should have already been created and initialized using an Event() constructor.

Note: When calling this method, the Event.target property is initialized to the current EventTarget.

Unlike "native" events, which the browser fires by queuing a task on the event loop, dispatchEvent() invokes all applicable event handlers synchronously before returning. The read-only isTrusted property is true for native events and false for events dispatched with dispatchEvent().

Syntax

js
dispatchEvent(event)

Parameters

event

The Event object to dispatch. Its Event.target property will be set to the current EventTarget.

Return value

false if event is cancelable, and at least one of the event handlers which received event called Event.preventDefault(). Otherwise true.

Exceptions

InvalidStateError DomException

Thrown if the event's type was not specified during event initialization.

Warning: Exceptions thrown by event handlers are reported as uncaught exceptions. The event handlers run on a nested callstack; they block the caller until they complete, but exceptions do not propagate to the caller.

Example

See Creating and dispatching events.

Specifications

Specification
DOM
# ref-for-dom-eventtarget-dispatchevent③

Browser compatibility

See also

  • The Event object reference

Help improve MDN

Learn how to contribute

This page was last modified on Jul 10, 2026 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.