Added click confirmation script.
This commit is contained in:
parent
ec5be8167e
commit
919f6e1e42
16
resources/views/private/_scripts/_click-confirm.blade.php
Normal file
16
resources/views/private/_scripts/_click-confirm.blade.php
Normal 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>
|
Loading…
Reference in New Issue
Block a user