| 1 | --- |
| 2 | title: "htmx:after:cleanup" |
| 3 | description: "After listeners and data are removed" |
| 4 | --- |
| 5 | |
| 6 | The `htmx:after:cleanup` event fires after htmx has removed all listeners and internal data from an element. |
| 7 | |
| 8 | ## When It Fires |
| 9 | |
| 10 | - After an element has been removed from the DOM |
| 11 | - After htmx has detached all event listeners |
| 12 | |
| 13 | ## Event Detail |
| 14 | |
| 15 | Empty - no additional context provided. |
| 16 | |
| 17 | ## Example |
| 18 | |
| 19 | ```javascript |
| 20 | htmx.on('htmx:after:cleanup', (evt) => { |
| 21 | console.log('Cleanup complete:', evt.target); |
| 22 | }); |
| 23 | ``` |
| 24 | |
| 25 | The element no longer has htmx behaviors attached at this point. |