目录

HTML DOM 元素 removeEventListener()

示例

从元素中删除 "mousemove" 事件:

myDIV.removeEventListener("mousemove", myFunction);
亲自试一试 »

描述

这个removeEventListener()方法从元素中删除事件处理程序。



语法

element.removeEventListener( event, function, capture)

参数

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.
useCapture 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.

返回值

没有任何

浏览器支持

element.removeEventListener()是 DOM Level 2 (2001) 功能。

所有浏览器都完全支持它:

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