htmx-extensions
htmx-extensions copied to clipboard
SSE Extension: Add support for `hx-select`
You can now use hx-select to select a portion of HTML from an SSE event to swap, just like you can with hx-get or hx-post.
Example:
Server Event:
data: <div id="message">Hello</div><div id="status">Online</div>
You can now select and swap just the #message div:
HTML:
<div sse-connect="/events" sse-swap="message" hx-select="#message">
<!-- This div will be updated with the content of #message -->
</div>
Htmx version: 2.0.6 Used extension(s) version(s): 2.2.2
Checklist
- [x] I have read the contribution guidelines
- [x] I ran the test suite locally (
npm run test) and verified that it succeeded
Deploy Preview for htmx-extensions canceled.
| Name | Link |
|---|---|
| Latest commit | 6678d227b9578c01e11814c67cad5307d828adf5 |
| Latest deploy log | https://app.netlify.com/projects/htmx-extensions/deploys/68a0eae5bf03e7000829d78a |