htmx/www/attributes/kt-select.md
2020-05-10 08:45:28 -07:00

702 B

layout title
layout.njk </> kutty - kt-select

kt-select

The kt-select attribute allows you to select the content you want swapped from a response. The value of this attribute is a CSS query selector of the element or elements to select from the response.

Here is an example that selects a subset of the response content:

<div>
    <button kt-get="/info" kt-select="#info-details" kt-swap="outerHTML">
        Get Info!
    </button>
</div>

So this button will issue a GET to /info and then select the element with the id info-detail, which will replace the entire button in the DOM.

Notes

  • kt-select is inherited and can be placed on a parent element