Skip to content
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-trigger from:<Extended CSS selector> breaks after target replaced #2540

Open
Mark7888 opened this issue May 9, 2024 · 0 comments
Open

Comments

@Mark7888
Copy link

Mark7888 commented May 9, 2024

I found a strange behaviour of hx-trigger, targeting another element with css selector. When I load the page, the trigger works as expected. But if I change the element it targets, the trigger no longer fires.
This is somewhat understandable, but pretty annoying to be honest.

Here is my sample code:

<body>
    <div id="testDiv" hx-get="/div" hx-targe="this" hx-trigger="keyup changed from:#testIn"></div>
    <button hx-get="/input" hx-target="#testIn" hx-swap="outerHTML">Change Input</button>
    <input type="number" id="testIn"></input>
</body>

Server side, /input just returns <input type="number" id="testIn" value=20></input>. Nothing special.

Before clicking the button, /div fires just fine. But after clicking it, it no longer works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant