Xóa cửa sổEventListener()
Ví dụ
Xóa trình xử lý sự kiện "mousemove":
window.removeEventListener("mousemove", myFunction);
Sự miêu tả
Phương thức removeEventListener()
loại bỏ trình xử lý sự kiện khỏi cửa sổ.
Phương pháp tài liệu
Phương thức addEventListener()
Phương thức RemoveEventListener()
Phương thức phần tử
Phương thức addEventListener()
Phương thức RemoveEventListener()
Hướng dẫn
Cú pháp
window.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. |
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. |
Giá trị trả về
KHÔNG CÓ |
Hỗ trợ trình duyệt
removeEventListener()
được hỗ trợ trong tất cả các trình duyệt:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |