mdhub/app/application/resources/views/_scripts/_click-confirm.blade.php

17 lines
530 B
PHP
Raw Permalink Normal View History

2024-06-18 22:35:54 +05:00
<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>