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

hx-method

The hx-method attribute specifies the HTTP method (verb) to use for the request.

Syntax

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

Notes

Examples

<!-- Explicit method specification -->
<button hx-action="/api/users/123" hx-method="delete">
    Delete User
</button>

<!-- Equivalent using hx-delete shorthand -->
<button hx-delete="/api/users/123">
    Delete User
</button>

<!-- Default to GET if no method specified -->
<button hx-action="/api/users">
    Get Users
</button>