Spec-Zone.ru › htmx

HX-Source

Identifies element that triggered the request

The HX-Source request header contains the element that triggered the request. Format is tag#id like button#submit.

Elements without an ID use only the tag name like div or form.

Example

Check which element triggered the request.

source = request.headers.get('HX-Source')
if source == 'button#submit-btn':
    # Handle button submission
    return handle_button_submit()

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

Spec-Zone.ru

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