Debian Codegraph @

www/src/content/reference/01-attributes/09-hx-select.md

raw symbols SCIP
1 ---
2 title: "hx-select"
3 description: "Controls which part of the response to insert"
4 ---
5
6 The `hx-select` attribute allows you to select the content you want swapped from a response. The value of
7 this attribute is a CSS query selector of the element or elements to select from the response.
8
9 ## Syntax
10
11 ```html
12 <button hx-get="/page" hx-select="#content">Load Content</button>
13 ```
14
15 Here is an example that selects a subset of the response content:
16
17 ```html
18 <div>
19 <button hx-get="/info" hx-select="#info-detail" hx-swap="outerHTML">
20 Get Info!
21 </button>
22 </div>
23 ```
24
25 So this button will issue a `GET` to `/info` and then select the element with the id `info-detail`,
26 which will replace the entire button in the DOM.