--- title: "hx-target" description: "Controls where the response is inserted" --- The `hx-target` attribute specifies where to insert the response content. Defaults to `this` (which represents the element making the request). ## Value ### `this` Target the element itself. ```html New link ``` The link updates itself when clicked. ### Extended Selectors Use any [extended selector](/docs#extended-selectors-1) to target elements: * CSS selectors: `#results`, `.container`, `[data-target]` * `closest ` - nearest ancestor (or the element itself) matching selector * `find ` - first child descendant matching selector * `findAll ` - all child descendant elements matching selector * `next` - next sibling element * `next ` - scan forward for selector * `previous` - previous sibling element * `previous ` - scan backward for selector See the full [extended selectors](/docs#extended-selectors-1) guide. ## Common Patterns ### Target a specific element ```html
``` ### Update parent container ```html
``` ### Update sibling element ```html
``` ### Update child element ```html
Loading...
```