-
I have one image with its src: <img src="/my-image-url"> I want this image to be reloaded when the user clicks in the image. Is it possible to have this behavior in htmx without returning the whole Something like this: <img hx-get="/my-image-url" hx-trigger="click"> I would like to avoid a new endpoint just to return the img tag: <a hx-get="/my-image-wrapper-url" hx-trigger="click, anyotherevent">
<img src="/my-image-url">
</a> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @davidjr82 This codepen suggests one solution using Hope this helps |
Beta Was this translation helpful? Give feedback.
-
Although this solution is valid, it still forces to create 2 endpoints, in the codepen, Thanks! |
Beta Was this translation helpful? Give feedback.
Hi @davidjr82
This codepen suggests one solution using
hx-on::after-request
and the internalevent.detail
. The mock server responds only with the urlHope this helps