Replies: 4 comments 3 replies
-
You can use javascript/hyperscript to change attribute on the div on a custom event. So you can update the "hx-get" attribute on the custom event. Or Or |
Beta Was this translation helpful? Give feedback.
-
I'm facing the same scenario and am very surprised that this is not supported out of the box. I feel it's a major gap in custom event handling of HTMX. But thanks @formoxyz for your explanation of workarounds. I tried following the hyperscript-approach, but am not able to get it working.
The log shows the updated hx-get value, but the request to the backend still uses the old value of hx-get. Do you have a minimal example showing the workflow? Thanks a lot! |
Beta Was this translation helpful? Give feedback.
-
Turns out it can be an extension, and it makes things very easy... #1260 |
Beta Was this translation helpful? Give feedback.
-
You can intercept the event and change the path before it is sent:
Will call |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have an element declaration like this:
When "my_event" is triggered, I'd like to change the "hx-get" url with the custom event details. For example, if the event has "id=100" info, then the url should be ""/my-url/show/100".
Any suggestion? Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions