Function: removeEvent()
ts
function removeEvent(
el,
type,
callback?,
options?): void;Remove an event listener from an element.
Parameters
| Parameter | Type | Description |
|---|---|---|
el | Element | The element to remove the event listener from. |
type | string | The event type to remove. |
callback | EventListener | The callback function to remove. |
options | RemoveEventOptions | The options object. |
Returns
void
Example
ts
const el = document.getElementById('my-element');
const callback = () => {
console.log('Button clicked');
};
// Add the event listener
addEvent(el, 'click', callback, { useCapture: false });
// Remove the event listener
removeEvent(el, 'click', callback, { useCapture: false });Since
1.0.0