Skip to content

<newbie> Communicate only with nearest ancestor #996

Answered by David-Guillot
yatesco asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @yatesco ,

Normally I would say that your question is a bit of htmx's scope, because it implies Javascript for pure-client-side interaction (closing a modal), and htmx is about client-server communication and managing application state through HTML's hypertext superpowers. This is why the example you provide uses hyperscript (the _="on click trigger closeModal" part of the "close" button of the modal).

So normally my answer would be "just plug in some JS logic in there, like the example does, but a bit smarter, maybe with your idea of a random ID for each window, which could be generated on server-side and thus injected in the HTML via a data-attribute", etc.

But I've come with a hacky…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yatesco
Comment options

Answer selected by yatesco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants