diff options
Diffstat (limited to 'www/content')
-rw-r--r-- | www/content/events.md | 2 | ||||
-rw-r--r-- | www/content/examples/confirm.md | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/www/content/events.md b/www/content/events.md index aaa0e791..42bd8eba 100644 --- a/www/content/events.md +++ b/www/content/events.md @@ -310,7 +310,7 @@ This event is triggered before the content is saved in the history api. ### Event - `htmx:load` {#htmx:load} -This event is triggered when a new node is loaded into the DOM by htmx. +This event is triggered when a new node is loaded into the DOM by htmx. Note that this event is also triggered when htmx is first initialized, with the document body as the target. ##### Details diff --git a/www/content/examples/confirm.md b/www/content/examples/confirm.md index 42f70031..5b3a272a 100644 --- a/www/content/examples/confirm.md +++ b/www/content/examples/confirm.md @@ -37,9 +37,9 @@ which is then picked up by `hx-trigger`. <script> document.addEventListener("htmx:confirm", function(e) { // The event is triggered on every trigger for a request, so we need to check if the element - // that triggered the request has a hx-confirm attribute, if not we can return early and let - // the default behavior happen - if (!e.detail.elt.hasAttribute('hx-confirm')) return + // that triggered the request has a confirm question set via the hx-confirm attribute, + // if not we can return early and let the default behavior happen + if (!e.detail.question) return // This will prevent the request from being issued to later manually issue it e.preventDefault() |