https://htmx.org logo
If I have a modal that submits a form (hx-delete i...
# htmx-general
s
If I have a modal that submits a form (hx-delete in my case), and the modal closes (via hyperscript
remove me
call) then I've noticed that
HX-Trigger
response headers are aren't triggering my hx-trigger that is watching for the event: (
hx-trigger="requestDeleted from:body"
). I'm guessing that the event IS triggered on the element, but it is no longer in the DOM so it doesn't bubble up to the body. Is there a preferred work around or is this an HTMX bug? Maybe some way to wait for the http request returns before removing the modal?
Something like:
on click wait for htmx:afterRequest from me then trigger closeModal
OK
me
didn't work since that referred to the button. This did:
on click wait for htmx:afterRequest from #deleteRequestForm then trigger closeModal
Nice!
m
hey now, that's pretty clean!