> For the complete documentation index, see [llms.txt](https://jscula.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jscula.gitbook.io/docs/events/.off.md).

# .off()

`.off()` removes an event listener.

You must pass the same function reference that was used when adding the listener.

***

#### Syntax

```js
element.off(eventType, handlerFunction);
```

***

#### Parameters

* `eventType` → event name
* `handlerFunction` → same function that was added earlier

***

#### Output

```js
HTMLElement | NodeList | HTMLCollection
```

***

#### Example

```js
function updatePreview() {
  $('#preview').text(this.val());
}

$('#name').onInput(updatePreview); //adds
$('#name').off('input', updatePreview); //removes
```

***

#### Key Takeaway

> `.off()` is for removing listeners you added before.
