Relative Content

Tag Archive for htmx

HTMX places whole HTML in div

I’ve got a form with an input. If the input gets a value, I’d like to fetch some descriptive information and show that underneath.

Update form fields on select change with HTMX

In one of my pages I have a select element and a form. What I want to achieve is to update the field values ​​in the form when the select changes, which happens successfully. I did many tests and read the documentation on htmx.org several times until I got this, but even now I don’t understand why my configuration works. Is it a bug? It is correct? I’m not sure at all, especially when I get the same good result with both hx-target="#title,#slug,#shortcode" and hx-target="#shortcode", the main one being at least one of the three target ids to be included in the hx-target, otherwise the select is removed when the form fields are replaced. What do you think?

best client-side javascript recipe for htmx

I’m trying out htmx for the first time, I feel it can be right up my alley.
I have this really simple example and would like to add some client side functionality.
In this case, let say i want a min = 0 and max = 10 and disable the increment and decrement buttons accordingly.
Obviously, here, my desired outcome doesn’t happen, because the main render only renders at the page request and so, the “decrement” button starts off and always stays disabled and the “increment” never becomes disabled…

‘htmx:confirm’ event firing on every ajax call

I’m attaching a htmx:confirm event listener to the body so as to override the default browser confirm UI with sweetalert2 library as shown in this example. However I’m running into unnecessary prompts every time Htmx makes an ajax call. Below is my Html.