Attributes32Core hx-getIssue GET request to specified URL hx-postIssue POST request to specified URL hx-swapSpecify the method for swap hx-targetSpecify target element for swap hx-triggerSpecify event that triggers request hx-selectSelect content to swap from response hx-onHandle events with inline scripts hx-putIssue PUT request to specified URL hx-patchIssue PATCH request to specified URL hx-deleteIssue DELETE request to specified URL hx-valsAdd values to request parameters Additional hx-swap-oobSwap element out of band hx-push-urlPush URL into browser history hx-includeInclude additional element values in request hx-select-oobSelect content for out-of-band swap hx-boostConvert links and forms to AJAX hx-replace-urlReplace current URL in browser history hx-confirmShow confirmation dialog before request hx-disableDisable elements during request hx-preservePreserve element during swaps hx-headersAdd custom headers to request hx-indicatorSpecify loading indicator element hx-syncSynchronize requests between elements hx-preloadPreload content before user triggers request hx-validateValidate before submitting request hx-encodingSet request encoding type hx-actionSpecify URL to receive request hx-methodSpecify HTTP method for request hx-configConfigure request behavior with JSON hx-ignoreDisable htmx processing for element hx-optimisticShow optimistic content during request hx-statusHandle responses differently by status code Headers15Request HX-RequestIndicates a request was made by htmx HX-Request-TypeIndicates if this is a partial or full page request HX-Current-URLContains the URL of the browser when the request was made HX-SourceIdentifies the element that triggered the request HX-TargetThe element that will receive the response HX-BoostedIndicates a boosted navigation request HX-History-Restore-RequestIndicates history navigation (back/forward) AcceptContent types htmx accepts from the server Last-Event-IDLast received SSE event ID for reconnection Response HX-TriggerTrigger client-side events from the server HX-LocationClient-side AJAX navigation to a new URL HX-RedirectClient-side redirect to a new URL HX-RefreshTrigger a full page reload HX-Push-UrlPush a URL into the browser history stack HX-Replace-UrlReplace the current URL in the browser history Events30 htmx:config:requestConfigure request before it's sent htmx:before:requestImmediately before fetch is called htmx:after:requestAfter response is received htmx:finally:requestAt the end of request lifecycle htmx:before:swapBefore content is swapped into DOM htmx:after:swapAfter content is swapped into DOM htmx:before:cleanupBefore htmx removes element data htmx:after:cleanupAfter listeners and data are removed htmx:confirmShow confirmation dialog before request htmx:errorWhen an error occurs during request htmx:abortTrigger to abort an ongoing request htmx:before:initBefore a specific element is initialized htmx:after:initAfter an element is fully initialized htmx:before:processBefore htmx processes a DOM node htmx:after:processAfter htmx processes a DOM node htmx:process:{type}Custom template processing htmx:after:implicitInheritanceAfter implicit inheritance is applied htmx:before:history:updateBefore browser history is updated htmx:after:history:updateAfter browser history is updated htmx:after:history:pushAfter a push state action htmx:after:history:replaceAfter a replace state action htmx:before:history:restoreBefore restoring from history htmx:before:viewTransitionBefore View Transition API starts htmx:after:viewTransitionAfter View Transition completes loadFired immediately after initialization intersectElement enters viewport everyPeriodic polling trigger htmx:before:responseAfter a response is received but before the body is consumed htmx:before:settleBefore the settle phase begins after a swap htmx:after:settleAfter the settle phase completes Config24 htmx.configConfigure htmx behavior globally htmx.config.defaultSwapDefault swap style for responses htmx.config.defaultTimeoutDefault timeout for requests in milliseconds htmx.config.extensionsComma-separated list of extensions to load htmx.config.historyControl htmx browser history management htmx.config.implicitInheritanceEnable implicit attribute inheritance htmx.config.includeIndicatorCSSInclude default indicator CSS htmx.config.indicatorClassCSS class for loading indicators htmx.config.logAllLog all htmx events to console htmx.config.modeSet request mode for fetch API htmx.config.morphIgnoreAttributes to ignore during morphing htmx.config.morphSkipSkip morphing for specific elements htmx.config.morphSkipChildrenSkip morphing children of specific elements htmx.config.noSwapHTTP status codes that skip swap htmx.config.prefixSet a custom attribute prefix htmx.config.requestClassCSS class applied during requests htmx.config.transitionsEnable View Transitions API support htmx.versionCurrent htmx version (read-only) htmx.config.defaultFocusScrollScroll to the focused element after a swap htmx.config.defaultSettleDelayDelay between the swap and settle phases in milliseconds htmx.config.inlineScriptNonceNonce value added to inline scripts generated by htmx htmx.config.inlineStyleNonceNonce value added to inline styles generated by htmx htmx.config.morphScanLimitMaximum number of siblings scanned when matching elements during morphing htmx.config.metaCharacterCustom character used instead of `:` for attribute modifiers Methods13 htmx.ajax()Issues an htmx-style ajax request htmx.find()Find first matching element htmx.findAll()Find all matching elements htmx.forEvent()Wait for an event with optional timeout htmx.on()Listen for htmx events htmx.onLoad()Execute callback when elements are loaded htmx.parseInterval()Parse time intervals to milliseconds htmx.process()Process htmx attributes on element htmx.registerExtension()Register htmx extension htmx.takeClass()Move a class to a specific element htmx.timeout()Create a timeout promise htmx.trigger()Trigger custom events htmx.swap()Perform an HTML content swap into the DOM