-
Notifications
You must be signed in to change notification settings - Fork 0
removeListener
Mike Byrne edited this page Mar 14, 2023
·
1 revision
Introduced 3.1.0
Remove event listeners to node lists instead of singular nodes.
(applies removeEventListener
to a NodeList
)
- nothing
- nodes - required - DOM NodeList to remove event listeners from
- type - required - event type being listened to
- func - required - the function to attach
- options - optional - event listener options
- nothing
function handler() {};
listeners.remove(document.querySelectorAll('button'), 'click', handler);
With options
set:
function handler() {};
listeners.remove(document.querySelectorAll('button'), 'click', handler, { passive: true, once: true });
Note Remember, if you want to remove event listeners, you need to specify the same function reference and same options when removing as when adding.