Debian Codegraph @

www/src/content/reference/04-config/02-htmx-config-defaultSwap.md

raw symbols SCIP
1 ---
2 title: "htmx.config.defaultSwap"
3 description: "Default swap style for responses"
4 ---
5
6 The `htmx.config.defaultSwap` option sets the default swap style when [`hx-swap`](/reference/attributes/hx-swap) is not specified.
7
8 **Default:** `"innerHTML"`
9
10 ## Valid Values
11
12 - `"innerHTML"` - Replace inner content
13 - `"outerHTML"` - Replace entire element
14 - `"beforebegin"` - Insert before element
15 - `"afterbegin"` - Insert as first child
16 - `"beforeend"` - Insert as last child
17 - `"afterend"` - Insert after element
18 - `"delete"` - Delete the target element
19 - `"none"` - Don't swap content
20
21 ## Example
22
23 ```javascript
24 htmx.config.defaultSwap = "outerHTML";
25 ```
26
27 ```html
28 <meta name="htmx-config" content='{"defaultSwap":"outerHTML"}'>
29 ```