htmx.config.defaultSwap
Sets default swap style for responses
The htmx.config.defaultSwap option sets the default swap style when hx-swap is not specified.
Default: "innerHTML"
Valid Values
-
"innerHTML"- Replace inner content -
"outerHTML"- Replace entire element -
"beforebegin"- Insert before element -
"afterbegin"- Insert as first child -
"beforeend"- Insert as last child -
"afterend"- Insert after element -
"delete"- Delete the target element -
"none"- Don’t swap content
Example
htmx.config.defaultSwap = "outerHTML";
<meta name="htmx-config" content='{"defaultSwap":"outerHTML"}'>
Licensed under the Zero-Clause BSD License.
https://four.htmx.org/reference/config/htmx-config-defaultSwap/