Movatterモバイル変換


[0]ホーム

URL:


</> htmx

hx-include

Thehx-include attribute allows you to include additional element values in an AJAX request. The value of thisattribute can be:

Here is an example that includes a separate input value:

<div>    <buttonhx-post="/register"hx-include="[name='email']">        Register!    </button>    Enter email: <inputname="email"type="email"/></div>

This is a little contrived as you would typically enclose both of these elements in aform and submitthe value automatically, but it demonstrates the concept.

Note that you can also use theinherit keyword to inherit parent values for inclusion and add additional values:

<mainhx-include="#hidden-input">    ...    <buttonhx-post="/example"hx-include="inherit, [name='email']">        Post It!    </button>    Enter email: <inputname="email"type="email"/></main>

Finally, note that if you include a non-input element, all input elements enclosed in that element will be included.

Notes


[8]ページ先頭

©2009-2025 Movatter.jp