HTML DOM Document removeEventListener()
Example
Remove a "mousemove" event handler:
document.removeEventListener("mousemove", myFunction);
Try it Yourself »
Definition and Usage
The removeEventListener()
method removes an event handler from a document.
Element Methods
The removeEventListener() Method
Document Methods
The removeEventListener() Method
Tutorials
Syntax
document.removeEventListener(event, function, capture)
Parameters
Parameter | Description |
event | Required. The name of the event to remove. Do not use the "on" prefix. use "click" instead of "onclick". All HTML DOM events are listed in the: HTML DOM Event Object Reference. |
function | Required. The function to remove. |
capture |
Optional (default = false).true - Remove the handler from capturing.false - Remove the handler from bubbling.If the event handler was attached two times, one with capturing and one with bubbling, each must be removed separately. |
Return Value
NONE |
Browser Support
document.removeEventListener()
is a DOM Level 2 (2001) feature.
It is fully supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 9-11 | Yes | Yes | Yes | Yes |