hx-pod
hx-pod
Lazarus
The basics: hx-preserve
2 minutes Posted Feb 9, 2024 at 8:49 pm.
0:00
2:32
Download MP3
Show notes

Updating a chunk of the DOM is easy --  but what if you wanted to leave one element alone?

<div id="leave-me-alone" hx-preserve>Content preserved</div>

Content will NOT be swapped out in the request, as long as the id in the request data matches.

https://htmx.org/attributes/hx-preserve/