shelfy/templates/assets/js/function/login.js
2025-06-06 09:42:55 +02:00

13 lines
562 B
JavaScript

document.body.addEventListener('htmx:confirm', function(evt) {
// 0. To modify the behavior only for elements with the hx-confirm attribute,
// check if evt.detail.target.hasAttribute('hx-confirm')
// 1. Prevent the default behavior (this will prevent the request from being issued)
evt.preventDefault();
// 2. Do your own logic here
console.log(evt.detail)
// 3. Manually issue the request when you are ready
evt.detail.issueRequest(); // or evt.detail.issueRequest(true) to skip the built-in window.confirm()
});