htmx 4.0 is under construction — migration guide

Active Validation

Validate form input as you type

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>

On the server, respond with a validation message:

<span class="error">That username is taken.</span>

Or an empty <span> when valid.