htmx

v2.0.11

Access AJAX, CSS transitions and server sent events directly from HTML attributes.

Quick start

Add this tag to your page. Place it just before the closing </body> tag, or in the <head> with the defer attribute.

HTML
<script src="https://jscdns.net/libs/htmx/2.0.11/htmx.min.js"
        integrity="sha384-2OatzQy1H+Zd/IIrjr1TcuDGqLXeHhbooAyJY1KdQMKnr4LZ22k31GBLdYKHmVjg" crossorigin="anonymous"></script>

Files

FileSizeCopy
htmx.min.jsScript 51.0 KB
htmx.esm.jsES module 167.4 KB

Usage

Complete example

A minimal page that loads htmx and uses it. Copy it into a file and open it in your browser.

example.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
</head>
<body>
  <button hx-get="/api/greeting" hx-target="#reply" hx-swap="innerHTML">
    Load greeting
  </button>
  <div id="reply"></div>

  <script src="https://jscdns.net/libs/htmx/2.0.11/htmx.min.js"
          integrity="sha384-2OatzQy1H+Zd/IIrjr1TcuDGqLXeHhbooAyJY1KdQMKnr4LZ22k31GBLdYKHmVjg" crossorigin="anonymous"></script>
</body>
</html>
Good to know. htmx expects your server to return HTML fragments, which it swaps into the page.