Favorites

DOM EventTarget.removeEventListener() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
EventTarget.removeEventListener()
DOM EventTarget MethodThis method is supported by all modern browsers.
Updated 28th November 2026

The removeEventListener() method removes an event listener that was added with addEventListener(), using the same event type and function.

Description

The removeEventListener() method removes a listener previously registered with addEventListener(). You must pass the same function reference and the same capture setting; an identical-looking anonymous function is a different function and won't remove anything.

Alternatives are the once: true option for listeners that should run a single time, and the signal option with an AbortController, which can remove many listeners at once.

Listeners that are already scheduled to run in the current dispatch still run if they're removed by an earlier listener for the same event. Removing listeners is important for components that are added and removed from the page repeatedly, since forgotten listeners on long-lived objects such as window keep the component's data in memory.

Syntax

target.removeEventListener(type, listener)
target.removeEventListener(type, listener, options)

Parameters

  • typeThe event type, such as "click".
  • listenerThe same function that was passed to addEventListener().
  • optionsOptional. Must have the same capture setting used when adding.

Return Value

None (undefined).

Example

<button id="btn" type="button">Button</button>
const btn = document.getElementById('btn');
function onClick() { console.log('clicked'); }
btn.addEventListener('click', onClick);
btn.click();
btn.removeEventListener('click', onClick);
btn.click();   // nothing logged

const controller = new AbortController();
btn.addEventListener('click', () => console.log('abortable'), { signal: controller.signal });
controller.abort();
btn.click();

Browser Support

The following information will show you the current browser support for the EventTarget.removeEventListener() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee