agreeable-apartment-19546
01/25/2023, 12:06 AMHX-Trigger: spot_successful
in the headers. I've confirmed in the dev tools that the header is present in the POST response ( although it's lowercase, hx-trigger
). In the HTML itself, I have tried both document.body.addEventListener
and htmx.on
and neither seem to trigger. Example :
htmx.on("spot_successful", function (event) {
alert("SUCCESS");
toast.classList.remove("hidden");
setTimeout(function () {
toast.classList.add("hidden");
}, 3000);
});
I'm just trying to have a toast appear and go away again.mysterious-toddler-20573
01/25/2023, 12:10 AMagreeable-apartment-19546
01/25/2023, 12:11 AMxhr.send
on a XMLHttpRequest
agreeable-apartment-19546
01/25/2023, 12:11 AMmysterious-toddler-20573
01/25/2023, 12:44 AMmysterious-toddler-20573
01/25/2023, 12:45 AMmysterious-toddler-20573
01/25/2023, 12:45 AMagreeable-apartment-19546
01/25/2023, 12:45 AMagreeable-apartment-19546
01/25/2023, 12:46 AMmysterious-toddler-20573
01/25/2023, 12:47 AMhtmx:configRequest
event and modify parameters, headers, etc: https://htmx.org/events/#htmx:configRequestagreeable-apartment-19546
01/25/2023, 12:47 AMagreeable-apartment-19546
01/25/2023, 12:49 AMdetail.parameters
to the payload I want perhapslate-king-98305
01/25/2023, 2:03 AMlate-king-98305
01/25/2023, 2:13 AMhx-target
(_hxTarget
) is a modal area. The code line 30 is a part of is rendered multiple times per page, but the modal target area is rendered once per page, starting in line 98; the actual #snoozeBody
target is on line 109, and ends up being rendered initially as an empty div
.
The content of that body is filled in line 172 and following, based on the URL fired off by the button click.
For closing it once processing is complete, I return a header from the server, then fire off the click
event of the close button when that header. That's in https://github.com/bit-badger/myPrayerJournal/blob/main/src/MyPrayerJournal/wwwroot/script/mpj.js - the handler starts on line 85, and the part that responds to the header is lines 91-94.
Hope that helps; if not, let us know what questions you might have about it.salmon-church-58191
01/25/2023, 3:35 AMbillions-easter-81130
01/25/2023, 8:06 AMbland-coat-6833
01/25/2023, 9:26 AMhx-delete
in the actual table itself. These have the same target but the response gets added to the table content unless I specify an hx-swap='innerHTML'
.bland-coat-6833
01/25/2023, 9:26 AMhx-swap
then I also get an error in the consoleglamorous-honey-42686
01/25/2023, 11:05 AMorange-umbrella-16693
01/25/2023, 12:18 PMorange-umbrella-16693
01/25/2023, 12:19 PMfreezing-waitress-26396
01/25/2023, 1:19 PMfreezing-waitress-26396
01/25/2023, 1:21 PMfancy-elephant-10660
01/25/2023, 1:26 PMboundless-vase-80440
01/25/2023, 1:32 PMfancy-elephant-10660
01/25/2023, 1:32 PMboundless-vase-80440
01/25/2023, 1:33 PMboundless-vase-80440
01/25/2023, 1:36 PMboundless-vase-80440
01/25/2023, 1:37 PMThe hx-push-url attribute allows you to push a URL into the browser location history. This creates a new history entry, allowing navigation with the browserโs back and forward buttons. htmx snapshots the current DOM and saves it into its history cache, and restores from this cache on navigation.
boundless-vase-80440
01/25/2023, 1:39 PMhx-history-elt