The HX-Reselect response header overrides which part of the response is used for swapping, replacing whatever hx-select was set on the triggering element.
Syntax
HX-Reselect: #content
The value is a CSS selector applied to the response HTML to extract the content to swap in.
Example
Return a full page but tell htmx to only use a specific fragment:
return Response( full_page_html, headers={'HX-Reselect': '#main-content'} )
Notes
- Overrides
hx-selecton the source element - Evaluated after the response is received, before swapping
See also: hx-select, HX-Retarget, HX-Reswap