</> htmx
🚧 htmx 4.0 is under construction. Read changes →

hx-action

The hx-action attribute specifies the URL that will receive the request.

Syntax

<button hx-action="/api/users" hx-method="post">
    Create User
</button>

Notes

Examples

<!-- Using hx-action with hx-method -->
<button hx-action="/api/users" hx-method="post">
    Create User
</button>

<!-- Equivalent using hx-post shorthand -->
<button hx-post="/api/users">
    Create User
</button>