@@ -5,21 +5,15 @@ title = "hx-target"
55The ` hx-target ` attribute allows you to target a different element for swapping than the one issuing the AJAX
66request. The value of this attribute can be:
77
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).
1212* ` 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.
1614 (e.g. ` next .error ` will target the closest following sibling element with ` error ` class)
1715* ` previous <CSS selector> ` which will scan the DOM backwards for the first element that matches the given CSS selector.
1816 (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)
2317
2418
2519Here is an example that targets a div:
0 commit comments