Skip to content

Commit f4cc838

Browse files
authored
Correction for confirm example (#3296)
1 parent 0da0383 commit f4cc838

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

www/content/examples/confirm.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ which is then picked up by `hx-trigger`.
3737
<script>
3838
document.addEventListener("htmx:confirm", function(e) {
3939
// The event is triggered on every trigger for a request, so we need to check if the element
40-
// that triggered the request has a hx-confirm attribute, if not we can return early and let
41-
// the default behavior happen
42-
if (!e.detail.elt.hasAttribute('hx-confirm')) return
40+
// that triggered the request has a confirm question set via the hx-confirm attribute,
41+
// if not we can return early and let the default behavior happen
42+
if (!e.detail.question) return
4343
4444
// This will prevent the request from being issued to later manually issue it
4545
e.preventDefault()

0 commit comments

Comments
 (0)