htmx-extensions icon indicating copy to clipboard operation
htmx-extensions copied to clipboard

SSE Extension: Add support for `hx-select`

Open scriptogre opened this issue 8 months ago • 1 comments

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

scriptogre avatar Aug 16 '25 20:08 scriptogre

Deploy Preview for htmx-extensions canceled.

Name Link
Latest commit 6678d227b9578c01e11814c67cad5307d828adf5
Latest deploy log https://app.netlify.com/projects/htmx-extensions/deploys/68a0eae5bf03e7000829d78a

netlify[bot] avatar Aug 16 '25 20:08 netlify[bot]