4 ms·
I'm really enjoying using htmx nowadays to sprinkle interactivity on server-rendered pages with almost no JavaScript. Its extra attributes make it easy to do co
by yawaramin 4y ago
I'm really enjoying using htmx nowadays to sprinkle interactivity on server-rendered pages with almost no JavaScript. Its extra attributes make it easy to do common interactions on pages. Highly recommended 12 KB gzipped zero-dependency JavaScript. Example:
<button
title="Remove 'ABC' from cart"
hx-delete="/cart/123/item/abc"
hx-target="#item-abc">
Clicking this button will trigger a `DELETE /cart/123/item/abc` request and swap the response into the element selected by the `hx-target` selector. The response would be an HTML fragment. So instead of an API serving JSON you would have an API serving...HTML. It's a neat fit with any server rendering technology.