Web APIs

Event.stopImmediatePropagation()

Try the free JavaScript compiler

Stop further dispatch to subsequent listeners on the current target and other targets. This does not itself cancel the default action. Example console output: 1.

Formal Syntax & Structure

javascript syntaxjavascript
event.stopImmediatePropagation()

Return Value

undefined

No result value.

Working Example

Example Snippetjavascript
const t=new EventTarget(); const seen=[]; t.addEventListener("save",e=>{seen.push(1);e.stopImmediatePropagation()}); t.addEventListener("save",()=>seen.push(2)); t.dispatchEvent(new Event("save")); console.log(seen.join(","));
JavaScript Reference