Web APIs

CustomEvent.detail

Try the free JavaScript compiler

Exposes the data supplied when constructing a custom event. It is not automatically cloned or validated.

Formal Syntax & Structure

javascript syntaxjavascript
event.detail

Return Value

unknown

Payload, or null by default.

Working Example

Example Snippetjavascript
const e=new CustomEvent("saved",{detail:{id:3}}); console.log(e.detail.id);
JavaScript Reference