| 1 | --- |
| 2 | title: "htmx:before:process" |
| 3 | description: "Before htmx processes a DOM node" |
| 4 | --- |
| 5 | |
| 6 | The `htmx:before:process` event fires before htmx begins processing a DOM node or subtree to attach htmx behaviors. |
| 7 | |
| 8 | ## When It Fires |
| 9 | |
| 10 | - During initial page load processing |
| 11 | - After new content is swapped into the DOM |
| 12 | - When `htmx.process()` is called manually |
| 13 | |
| 14 | ## Event Detail |
| 15 | |
| 16 | Empty - no additional context provided. |
| 17 | |
| 18 | ## Example |
| 19 | |
| 20 | ```javascript |
| 21 | htmx.on('htmx:before:process', (evt) => { |
| 22 | console.log('About to process:', evt.target); |
| 23 | }); |
| 24 | ``` |
| 25 | |
| 26 | Cancel this event to prevent htmx from processing the element. |