gorgeous-airport-54386
04/27/2023, 7:32 PMgorgeous-airport-54386
04/27/2023, 7:33 PMshy-knife-59740
04/27/2023, 7:33 PMshy-knife-59740
04/27/2023, 7:33 PMshy-knife-59740
04/27/2023, 7:34 PMgorgeous-airport-54386
04/27/2023, 7:35 PMhttps://cdn.discordapp.com/attachments/725789747212976259/1101230040898879569/image.png▾
shy-knife-59740
04/27/2023, 7:58 PMwhite-motorcycle-95262
04/27/2023, 8:08 PMhx-swap="outerHTML"
shy-knife-59740
04/27/2023, 9:51 PMshy-knife-59740
04/27/2023, 9:52 PMwhite-motorcycle-95262
04/27/2023, 10:19 PMbitter-machine-55943
04/27/2023, 11:32 PMbitter-machine-55943
04/28/2023, 3:55 AMlittle-electrician-91324
04/28/2023, 9:26 AM<h1 hx-on="htmx:afterSettle: alert('hello1');
click: alert('hello2');">Hello</h1>
I'd like an alert to be shown as soon as the HTML returned in the fragment is loaded. But nothing happens. Clicking on the header will show an alert with "hello2". I've also tried changing the event to htmx:afterSwap
to no avail. How can I make this work?ripe-action-67367
04/28/2023, 9:42 AMhtmx:load
eventlittle-electrician-91324
04/28/2023, 12:16 PMlittle-electrician-91324
04/28/2023, 12:32 PM<div id="showIt"><!-- --></div>
<sl-button
id="someId"
variant="primary"
style="margin-bottom: 1rem;"
hx-get="/my-app/stuff"
hx-target="#showIt">
Show it
</sl-button>
/my-app/stuff
returns this HTML:
<button hx-on="click: alert('ikk')">Close</button>
This works exactly like I want the first time I click on the (sl-)button with id someId
. But the second time, I essentially just want the second button to be re-rendered again. But instead, I see two buttons next to each other with the text "Close" and I get an with HTMX:
mx.min.js:1 htmx:swapError
`
and
TypeError: t.onHandlers is not iterable
I don't understand why, and using htmx.logAll()
doesn't make me any wiser.
https://cdn.discordapp.com/attachments/725789747212976259/1101486201665486891/image.png▾
https://cdn.discordapp.com/attachments/725789747212976259/1101486202089132134/image.png▾
ripe-action-67367
04/28/2023, 12:39 PMlittle-electrician-91324
04/28/2023, 12:41 PMripe-action-67367
04/28/2023, 12:41 PMripe-action-67367
04/28/2023, 12:49 PMfor ... in
, not for ... of
, -> https://github.com/bigskysoftware/htmx/blob/master/src/htmx.js#L924mysterious-toddler-20573
04/28/2023, 1:18 PMmysterious-toddler-20573
04/28/2023, 1:18 PMblue-gold-89534
04/28/2023, 1:35 PMhx-trigger="load, every 30s"
I can make everything inside a tag "stay" with using hx-preserve="true"
on parent elements. I now want to start a js library (a chart that is being drawn) when htmx swapped in the <div>
to hold the chart. I tried:
htmx.onLoad(function(elt) {
chart();
}
but this initializes chart()
everytime another load, every Ns
triggers a reload. is there a way to identify a specific element for onLoad
?ripe-action-67367
04/28/2023, 1:55 PMbroad-greece-52242
04/28/2023, 3:09 PMhx-trigger="load delay:1s"
pattern and work fine before the form submission, but stop after the form submission. The desired behavior is to have the elements to continue to be triggered while the form submission is in flight. I have tried using hx-sync="#myform:queue first"
, but as described in the docs queues the events to be triggered after the form submission returns. Is there any way that I can have the elements trigger while the form submission is in flight? Thanks!mysterious-toddler-20573
04/28/2023, 3:15 PMelt
rather than globallyripe-action-67367
04/28/2023, 3:20 PMmysterious-toddler-20573
04/28/2023, 3:21 PMripe-action-67367
04/28/2023, 3:21 PM