HTMx is a set of extensions to HTML that bring many of the useful features of modern web browsers directly into HTML, rather than requiring javascript. It fills gaps in functionality found in standard HTML, dramatically expanding the expressiveness of HTTP and HTML.
Here is a simple example of HTMx in action:
<button hx-get="/example" hx-target="#myDiv">Click Me</button>
This example issues an AJAX request to /example
when a user clicks on it, and swaps the response
HTML into the element with the id myDiv
HTMx is inspired by intercooler.js, and aims to be a minimalist & dependency free implementation of the same concept.
Attribute | Description |
---|---|
hx-get | Issues an HTTP GET to the given URL |
hx-target | Specifies the target element that should be swapped |
hx-swap-style | Specifies how target element should be swapped: innerHTML, outerHTML, append |
Event | Description |
---|
Header | Description |
---|