--- includeMockServer: true title: "Reset on Submit" description: Clear form inputs after submission icon: "icon-[mdi--eraser]" ---
## Basic usage On the client, wrap your inputs in a ` ``` - [`hx-post`](/reference/attributes/hx-post) submits the form to `/chat`. - [`hx-target`](/reference/attributes/hx-target) points at the `#messages` container. - [`hx-swap`](/reference/attributes/hx-swap)=[`"beforeend"`](/reference/attributes/hx-swap#beforeend) appends each new message to the bottom. - [`hx-on:htmx:after:request`](/reference/attributes/hx-on) listens for the [`htmx:after:request`](/reference/events/htmx-after-request) event and calls `this.reset()` to clear the form. On the server, respond with the new message: ```html ``` ## Notes ### Without a form element The `reset()` method is only available on `