Comments (6)
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 hx-on
I've tried hyperscript and it is working as expected.
from htmx.
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. :)
from htmx.
I've tested my code again with some variants and here my observations:
- the formats
hx-on--customevent=
orhx-on-customevent=
are definitely not working - the format
hx-on="customevent:
is working, - the key "hx-trigger" passed as header is insensitive-case
The strange here is when I posted this issue, the format hx-on="customevent:
was not working but it is now @ _ @
however that format will be deprecated as documentation, so it is not really a solution. Moreover it seems hx-on
is very limited regarding the number of operations I can do, hyperscript is more flexible in this aspect.
from htmx.
Most likely you had Typo error, seems like htmx is case sensitive went it comes to headers, so instead of hx-trigger
, you use HX-Trigger
it will work fine.
Eg:
`import { Elysia } from "elysia";
import { html } from '@elysiajs/html'
const app = new Elysia()
app
.use(html())
.get('/', () => {
return '
})
.get('/binding', ({ set }) => {
set.headers['HX-Trigger'] = 'custom-event'
return '<span>Msg from server</span>'
})
.listen(3000);
console.log(
🦊 Elysia is running at http://${app.server?.hostname}:${app.server?.port}
);
`
from htmx.
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.
:)
from htmx.
Nice, good job!
from htmx.
Related Issues (20)
- Improve documentation for websocket extension
- native popovers
- hx-boosted forms issue requests even when `method="dialog"` or `formmethod="dialog"` HOT 2
- [2.0.0-beta3] Form file input submission differs from `v1` HOT 2
- optional hx-include or hx-include should not throw an error if no match found!
- wsReconnectDelay not working as advertised on Firefox HOT 1
- Weird behaviour with `hx-select-oob` and non-id selectors
- [Bug] HTTP Redirect 303 with Hx-Push-Url response header, does not push the url
- Setting to handle error response same as success HOT 5
- hx-select appending and overlap unintended parent element
- [Feature] Add animation hooks for hx-swap delete similiar to swap and settle
- Add documentation tip for hx-on when listening to another source
- Expose a promise to wait for, before swap
- Is there a way to avoid multiple hx-swap="afterend"? HOT 1
- hx-include specificity issues HOT 5
- unexpected behaviour with head-support - bug? HOT 4
- [version 2.0.0-beta4] New HTMX version with Web Components
- Not enough arguments to `document.evaluate` in PaleMoon browser HOT 2
- HX-Trigger Response Header does not work on page load HOT 1
- Infinite scroll using "intersect once" triggers again when revisited via back/forward history state. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from htmx.