top | item 38909569

(no title)

pondidum | 2 years ago

If I understood correctly, you can achive this with `hx-target` and `hx-select` - I'm doing this in an app to replace an editor content based on which link is clicked.

- https://htmx.org/attributes/hx-select/ - https://htmx.org/attributes/hx-target/

discuss

order

sethammons|2 years ago

Oh that's neat - so you can return more than htmx will use and it can select the element it needs in the response and discard the rest

joshmanders|2 years ago

Yep, I actually don't even do server side checks in my app I am building, I just hx-boost on my html element and then server side I redirect back to the page that should have the updated content, just like you would a traditional server rendered app, and htmx then swaps out the body, but if I use target and that I can tell it to only return say the `<main>` tag and maybe another part of the page, the rest doesn't change.

quickthrower2|2 years ago

That could be it! I missed that one. Will try it next time.