Skip to content
Discussion options

You must be logged in to vote

And finally in case anyone else has this problem. To generate an event from a js library like cytoscape and pass on parameters:

cy.on('tap', function(ev){
     target = (typeof ev.target.id == 'function') ? ev.target.id() : ""
     htmx.trigger(htmx.find('body'), "tap", {'target_id':target});
 });

Then with htmx catch the event and pass on parameter to endpoint:

<div id="detail4" hx-get="/detail" hx-trigger="tap from:body" hx-vals='js:{id: event.detail["target_id"]}'>Empty 4</div>

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by aalexei
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant