Basic usage
On the client, the input validates on each keystroke (debounced).
<input name="username" hx-post="/check-username" hx-trigger="input changed delay:300ms" hx-target="next span"> <span></span>
hx-postsends the value to/check-username.hx-triggerfires oninputafter a 300msdelay, and only when the value haschanged.hx-target="next span"puts the response into the next sibling<span>.
On the server, respond with a validation message:
<span class="error">That username is taken.</span>
Or an empty <span> when valid.