Phần tử DOM HTML loại bỏEventListener()
Ví dụ
Xóa sự kiện "mousemove" khỏi một phần tử:
myDIV.removeEventListener("mousemove", myFunction);
Hãy tự mình thử »Sự miêu tả
Phương thức removeEventListener()
loại bỏ trình xử lý sự kiện khỏi một phần tử.
Phương thức phần tử
Phương thức addEventListener()
Phương thức RemoveEventListener()
Phương pháp tài liệu
Phương thức addEventListener()
Phương thức RemoveEventListener()
Hướng dẫn
Cú pháp
element .removeEventListener( event , function , capture )
Thông số
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. |
Giá trị trả về
KHÔNG CÓ |
Hỗ trợ trình duyệt
element.removeEventListener()
là tính năng DOM Cấp 2 (2001).
Nó được hỗ trợ đầy đủ trong tất cả các trình duyệt:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 9-11 |