HTML DOM Document removeEventListener() Method

Definition and usage

removeEventListener() The method removes event handlers from the document.

Example

Remove the "mousemove" event handler:

document.removeEventListener("mousemove", myFunction);

Try it yourself

Syntax

document.removeEventListener(event, function, capture)

Parameters

Parameters Description
event

Required. The name of the event to be removed.

Do not use the "on" prefix.

Use "click" instead of "onclick".

All HTML DOM events are listed at:HTML DOM Event Object Reference

function Required. The function to be removed.
capture

Optional (default = false).

  • true - Remove the handler from the capture
  • false - Remove the handler from the bubble

If an event handler is added twice, once for capture and once for bubble, each must be removed separately.

Return value

None.

Browser support

document.removeEventListener() It is a DOM Level 2 (2001) feature.

All browsers support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support

Related pages

Element methods

addEventListener() method

removeEventListener() method

Document methods

addEventListener() method

removeEventListener() method

Tutorial

HTML DOM EventListener

Complete DOM Event List