@@ -5,21 +5,15 @@ title = "hx-target"
5
5
The ` hx-target ` attribute allows you to target a different element for swapping than the one issuing the AJAX
6
6
request. The value of this attribute can be:
7
7
8
- * a CSS query selector of the element to target
9
- * ` this ` which indicates that the element that the ` hx-target ` attribute is on is the target
10
- * ` closest <CSS selector> ` which will find the closest parent ancestor that matches the given CSS selector.
11
- (e.g. ` closest tr ` will target the closest table row to the element)
8
+ * A CSS query selector of the element to target.
9
+ * ` this ` which indicates that the element that the ` hx-target ` attribute is on is the target.
10
+ * ` closest <CSS selector> ` which will find the closest parent ancestor that matches the given CSS selector
11
+ (e.g. ` closest tr ` will target the closest table row to the element).
12
12
* ` find <CSS selector> ` which will find the first child descendant element that matches the given CSS selector.
13
- * a CSS query selector of the element to target
14
- * ` this ` which indicates that the element that the ` hx-target ` attribute is on is the target
15
- ` next <CSS selector> ` which will scan the DOM forward for the first element that matches the given CSS selector.
13
+ * ` next <CSS selector> ` which will scan the DOM forward for the first element that matches the given CSS selector.
16
14
(e.g. ` next .error ` will target the closest following sibling element with ` error ` class)
17
15
* ` previous <CSS selector> ` which will scan the DOM backwards for the first element that matches the given CSS selector.
18
16
(e.g ` previous .error ` will target the closest previous sibling with ` error ` class)
19
- * ` closest <CSS selector> ` which will find the closest parent ancestor that matches the given CSS selector.
20
- (e.g. ` closest table ` will target the closest parent table to the element)
21
- * ` find <CSS selector> ` which will find the first child descendant element that matches the given CSS selector.
22
- (e.g ` find tr ` will target the first child descendant row to the element)
23
17
24
18
25
19
Here is an example that targets a div:
0 commit comments