445 - Add hx-target="this" example

Added quick example for a link that can update itself using hx-target="this".
This commit is contained in:
makasaurus 2021-10-09 17:11:09 -04:00 committed by GitHub
parent bb86628681
commit 303624b78f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,11 @@ Here is an example that targets a div:
The response from the `/register` url will be appended to the `div` with the id `response-div`.
This example uses `hx-target="this"` to make a link that updates itself when clicked:
```html
<a hx-post="/new-link" hx-target="this" hx-swap="outerHTML">New link</a>
```
### Notes
* `hx-target` is inherited and can be placed on a parent element