mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-29 14:04:22 +00:00
682 B
682 B
layout | title |
---|---|
layout.njk | </> kutty - kt-target |
kt-target
The kt-target
attribute allows you to target a different element than the one issuing the AJAX
request. The value of this attribute is a CSS query selector of the element to target when swapping
new content into the DOM.
Here is an example that targets a div:
<div>
<div id="response-div"></div>
<button kt-post="/register" kt-target="#response-div" kt-swap="beforeEnd">
Register!
</button>
</div>
The response from the /register
url will be appended to the div
with the id response-div
.
Notes
kt-target
is inherited and can be placed on a parent element