
htmx Has a Free API: Build Modern Web Apps Without JavaScript Frameworks
What if you could build interactive web apps using just HTML attributes? No React. No build step. No npm install. That's htmx. What Is htmx? htmx gives any HTML element the ability to make HTTP requests and update the DOM. It extends HTML instead of replacing it. <script src= "https://unpkg.com/htmx.org@2.0.0" ></script> <!-- Click button → GET request → replace #results --> <button hx-get= "/api/users" hx-target= "#results" > Load Users </button> <div id= "results" ></div> That's a complete AJAX interaction. No JavaScript written. The Core Attributes <!-- Any element can make requests --> <button hx-get= "/api/data" > GET request </button> <form hx-post= "/api/users" > POST on submit </form> <button hx-delete= "/api/users/1" > DELETE request </button> <!-- Control what gets updated --> <button hx-get= "/search" hx-target= "#results" > Search </button> <button hx-get= "/row" hx-swap= "afterbegin" > Prepend </button> <button hx-get= "/row" hx-swap= "outerHTML" > Replace self </button> <
Continue reading on Dev.to Webdev
Opens in a new tab


