Questions tagged [htmx]

htmx allows you to access AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext

htmx.org

motivation

Why should only and be able to make HTTP requests?

Why should only click & submit events trigger them?

Why should only GET & POST be available?

Why should you only be able to replace the entire screen?

By removing these arbitrary constraints htmx completes HTML as a hypertext

345 questions
11
votes
1 answer

Multiple triggers for HTMX?

Is it possible to enable multiple trigger types for HTMX? What I want to do is to trigger HTMX on either content change or page load. So far, if I include both trigger types in hx-trigger, only the first trigger is executed; so in the example below,…
irahorecka
  • 1,447
  • 8
  • 25
10
votes
5 answers

handle errors with HTMX

jgirardet
  • 109
  • 2
  • 9
9
votes
2 answers

How do you handle a PATCH request from HTMX in Django?

I would like to send a PATCH request to my app but I'm not sure how to consume the request in Django. I am currently getting the following error. AttributeError: 'WSGIRequest' object has no attribute 'PATCH' The input field in the HTMX file looks…
Ben
  • 2,143
  • 2
  • 19
  • 27
8
votes
4 answers

Select2 "change" event does not trigger htmx

This works, the way I want it: If the
guettli
  • 25,042
  • 81
  • 346
  • 663
7
votes
2 answers

Submit form from the outside of form using htmx

How to submit a form using submit button or input type submit outside of the form? In HTML It can be done easily using form ID but I didn't find the way to submit the form outside of the form in HTMX? Can anybody help in this regard?
Haradhan Sharma
  • 111
  • 2
  • 6
7
votes
1 answer

htmx: onLoad: "on full page load" and "on after swap"

I would like to initialize a select element like in the tom-select Example with my own method: function my_select_init(el) { new TomSelect(el, { persist: false, …
guettli
  • 25,042
  • 81
  • 346
  • 663
7
votes
2 answers

How do I manually trigger a hx-get event of an element from JavaScript

I am using htmx to add some AJAX calls to my page. I have a cart-count element that is defined to retrieve the number of items in the cart 1s after the page is loaded:
user2283347
  • 670
  • 8
  • 12
6
votes
1 answer

How to implement a redirect with HTMX?

HTMX is great and using AJAX for most of the stuff is awesome! But from time to time I just need a real "phyiscal" redirect to another page. Any ideas how to achieve this without starting to write custom JS code? Thx!
Ron
  • 22,128
  • 31
  • 108
  • 206
6
votes
4 answers

In HTMX, how do I request a specific URL for each option within a select form element?

I'm using HTMX and would like to have a