← All examples

htmx

Nothing to call: selectors in swapped, morphed or cloned HTML are initialized automatically.

1. Swap (innerHTML)

2. country-change as a trigger

The event bubbles, so a form can react to it (here it just logs; normally hx-get / hx-post).

Pick a country…
<form hx-post="/checkout/refresh" hx-trigger="country-change">
  <input class="country-select" name="shipping_country" value="DE">
</form>

3. Cloned rows (“add another”)