17 lines
530 B
PHP
17 lines
530 B
PHP
|
<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>
|