Spec-Zone.ru › htmx

HX-Reselect

Overrides content selection from server

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.

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-select on the source element
  • Evaluated after the response is received, before swapping

See also: hx-select, HX-Retarget, HX-Reswap

Licensed under the Zero-Clause BSD License.
https://four.htmx.org/reference/headers/HX-Reselect/

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API