Skip to content

Trouble triggering custom events multiple times #692

Answered by jreviews
nikita-kazakov asked this question in Q&A
Discussion options

You must be logged in to vote

A couple of things.

  1. Try removing the extra space you have between from: and body. I think it's using the space as part of the selector.
<div hx-get="/tickets" hx-target="this" hx-trigger="click, customEvent from:body" hx-swap="afterend">
  1. You can use the htmx Javascript API to simplify the vanilla JS code:
htmx.trigger(htmx.find('body'),'customEvent')

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nikita-kazakov
Comment options

Answer selected by nikita-kazakov
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