I've been dipping more into HTMX recently and finding it to be a really productive way of building things.
(Your onclick example there is a bit weird, I've not needed to use handlers like that at all.)
Here's some recent HTMX I wrote:
<button class="button" hx-post="/shifts/33/edit/"
hx-vals='{"target_stewards": "1"}'
hx-target="closest .shift-mini"
hx-swap="outerHTML">-</button>
That gives me a button which, when clicked, POSTs target_stewards=1 to /shifts/33/edit/ and replaces the nearest div class="shift-mini" with the HTML returned by that endpoint.