Working with TE and HTMX (reinit partial) #1819
Closed
robkuz
started this conversation in
Chat about dev stuff
Replies: 2 comments 6 replies
-
Hi, I'm not sure if
... that is added at the end of your html page could be useful? |
Beta Was this translation helpful? Give feedback.
1 reply
-
I think I found a solution that works |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am working with TE and HTMX and it is a bit tricky.
HTMX returns partial HTML which will then inserted/replaced in(to) the existing HTML.
The problem thou is that when working with TE it might be necessary to initialize the TE components like
data-te-input-wrapper-init
which will be done correctly on full page load with<script defer src="https://cdn.jsdelivr.net/npm/tw-elements/dist/js/tw-elements.umd.min.js"></script>
but is notretriggered
when a DOM element swap happens.My solution so far has been to include the
<script>
in each partial I am returning so that the full tw-elements.und.min.js is run each time. However that is ugly AND it is also error prone when I include partials that are also available from the beginning. So on first page load the script is execed multiple times. This leads for example to the Accordion not working any more.Is there a way to tell TE to (re)initialize a part of the DOM by selector (#id)?
Beta Was this translation helpful? Give feedback.
All reactions