| 1 | --- |
| 2 | title: "HX-Source" |
| 3 | description: "Identifies the element that triggered the request" |
| 4 | --- |
| 5 | |
| 6 | The `HX-Source` request header contains the element that triggered the request. Format is `tag#id` like `button#submit`. |
| 7 | |
| 8 | Elements without an ID use only the tag name like `div` or `form`. |
| 9 | |
| 10 | ## Example |
| 11 | |
| 12 | Check which element triggered the request. |
| 13 | |
| 14 | ```python |
| 15 | source = request.headers.get('HX-Source') |
| 16 | if source == 'button#submit-btn': |
| 17 | # Handle button submission |
| 18 | return handle_button_submit() |
| 19 | ``` |