New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hx-on is not working for custom events #2539
Comments
Most likely you had Typo error, seems like htmx is case sensitive went it comes to headers, so instead of Eg: `import { Elysia } from "elysia"; const app = new Elysia() Test init target here <script src="https://unpkg.com/htmx.org@1.9.12"></script>'}) .get('/binding', ({ set }) => { set.headers['HX-Trigger'] = 'custom-event'
}) console.log( |
I don't think so because I previously tried (like as the reference video ) with "Hx-Trigger" and it didn't work. Instead of using |
Well I'm glad that you find another solution. But the example above it's working as well, maybe you use the "Hx-Trigger" with 'x' in lower case and it caused the issue? Not sure to be fair. :) |
I think the problem with hx-on is that it's listening on the element it is placed on. You'd need something like hx-on-from-body. :) |
I've tested my code again with some variants and here my observations:
The strange here is when I posted this issue, the format |
Nice, good job! |
Taking this video as reference I've tried to fire a custom event with
hx-on
attribute but is not working.Client-side code:
Layout component code:
Server side code for contacts Api (I'm using Bun with ElysiaJs):
after sending a Post request with a duplicate name, server returns this for Response Headers section:
However custom event is not fired as expected and console shows no output. I've tried with:
same result, no output.
The text was updated successfully, but these errors were encountered: