HTML DOM Element removeEventListener() Method
- Previous page removeChild()
- Next page replaceChild()
- Go back to the previous level HTML DOM Elements Object
Definition and usage
removeEventListener()
Method to remove event handlers from an element.
See also:
Element methods:
Document methods:
Tutorial:
Example
Remove the "mousemove" event from the element:
myDIV.removeEventListener("mousemove", myFunction);
Syntax
element.removeEventListener(type, listnener, useCapture)
Parameters
Parameters | Description |
---|---|
type |
Required. The event type of the event listener to be removed. Do not use the "on" prefix. For example, use "click" instead of "onclick". For a complete list of HTML DOM events, please visit:HTML DOM Event Object Reference Manual. |
listnener | Required. The event listener function to be removed. |
useCapture |
Optional (default is false).
If the event handler is appended twice, once for capture and once for bubble, each must be removed separately. |
Return value
None.
Technical details
removeEventListener()
This method will remove the specified event listener function. Parameters type and useCapture must be called with addEventListener() The corresponding parameters of the method are the same. If no event listener that matches the specified parameters is found, this method does nothing.
If an event listener function is removed by this method, it will no longer be called when the specified type of event occurs on the node. Even if an event listener is removed by another event listener of the same type registered on the same node, it will not be called again.
This method is also Document and Window Object definition, and the working method is similar.
Browser support
element.removeEventListener()
It is a DOM Level 2 (2001) feature.
All browsers fully support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | 9-11 | Support | Support | Support | Support |
- Previous page removeChild()
- Next page replaceChild()
- Go back to the previous level HTML DOM Elements Object