Added click confirmation script.

This commit is contained in:
Leonid Nikitin 2023-07-12 23:31:20 +06:00
parent ec5be8167e
commit 919f6e1e42
Signed by: kor-elf
GPG Key ID: 7DE8F80C5CEC2C0D

View File

@ -0,0 +1,16 @@
<script>
(function() {
function clickConfirmAddEventListener(element, index, array) {
element.addEventListener('click', (e) => {
const result = confirm('{{ $alert }}');
if (! result) {
e.preventDefault();
}
});
}
let clickConfirm = document.querySelectorAll('.click-confirm');
if (clickConfirm.length > 0) {
clickConfirm.forEach(clickConfirmAddEventListener);
}
})();
</script>