See the demo here
htmx offers a few different ways to swap the HTML returned into the DOM. By default, the content replaces the innerHTML of the target element. You can modify this by using the hx-swap attribute with any of the following values:
- innerHTML
- outerHTML
- afterbegin
- beforebegin
- afterend
- beforeend