Hx-trigger attribute
The hx-trigger attribute specifies the browser events and timing conditions that cause HTMX to issue a request or refresh an element.
Django in Action
hx-trigger is an HTMX HTML attribute that specifies the browser event and timing conditions that initiate an HTMX request.
- How it is used
- Controls when an HTMX HTTP request runs for interactions, page loading, typing, and visible scrolling elements.
- How deep it goes
- Explains concrete trigger values and filters through lazy loading, search, and infinite-scroll implementations rather than HTMX internals.
- Examples
- Demonstrates a delayed promoter listing, debounced musician search, and revealed-element pagination for infinite scroll.
- What you can do after
- Apply it via HTMX to time GET requests for loading content, searching input, and fetching additional scrolling results.
Quarkus in Action
The hx-trigger attribute declares the events that cause HTMX to issue a request or refresh an element.
- How it is used
- Controls when HTMX requests refresh reservation-page tables.
- How deep it goes
- Works through load and a custom body event on an availability div, without cataloging other triggers.
- Examples
- Shows tables loading on page entry and an availability list listening for a reservation-driven refresh event.
- What you can do after
- Apply it via HTMX to load tables on page entry and listen for a custom refresh event.
Related concepts
- HTTP GETconfigures · HTTP GET is a request method for retrieving a representation of a resource identified by the request target, without requesting a state change.
- lazy initializationused by · Lazy initialization is a technique that postpones creating, retrieving, computing, or loading a value or resource until it is needed.
- HTMXconfigures · HTMX is a JavaScript library that enables HTML attributes to initiate HTTP interactions, handle events, and update portions of a page.
- hx-target attributeconfigures · The hx-target attribute identifies the HTML element whose content or element HTMX updates with a request response.
- hx-post attributeconfigures · The hx-post attribute configures HTMX to issue an HTTP POST request to a specified endpoint in response to an interaction or event.
- HX-Trigger-After-Swap HTTP headerconfigured by · The HX-Trigger-After-Swap HTTP header instructs HTMX to dispatch named events after replacing the target content.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

