Events API
evt.off()
asyncDynamically disables all events, or specific events passed to it, either globally or for matched DOM elements.
-
Accepts arguments that contain event names as strings or arrays of strings.
You can pass event names as individual arguments, as an array, or as a string separated by commas or spaces.
Each value is seen as a new argument. - It is not necessary to wait for the method to be executed using await if not needed.
Example:
// Disables all events that have been enabled.
evt.off();
// Disables the events that are passed.
evt.off('click');
evt.off('click', 'resize', 'visible', 'invisible', 'mutation');
evt.off(['click', 'resize', 'visible', 'invisible', 'mutation']);
evt.off('click, resize, visible, invisible, mutation');
evt.off('click resize visible invisible mutation');
// Disables all available events on the <div> element.
$('div').evt.off();
// Disables all available events on all <div> elements.
$('div ?').evt.off();
// Disables the events that are passed on the matched <div> element.
$('div').evt.off('click', 'resize');
// Disables the events that are passed on all <div> elements.
$('div ?').evt.off('click', 'resize');
// Waits for the event listener to be disabled.
await evt.off('click');