35603-vm/assets/js/main.js
2025-11-09 16:42:16 +00:00

19 lines
716 B
JavaScript

document.addEventListener('DOMContentLoaded', function () {
// Initialize toasts if they are present
var toastElList = [].slice.call(document.querySelectorAll('.toast'));
var toastList = toastElList.map(function (toastEl) {
return new bootstrap.Toast(toastEl, { delay: 3000 });
});
toastList.forEach(toast => toast.show());
// Add confirmation to delete buttons
const deleteForms = document.querySelectorAll('form.delete-task-form');
deleteForms.forEach(form => {
form.addEventListener('submit', function (event) {
if (!confirm('Are you sure you want to delete this task?')) {
event.preventDefault();
}
});
});
});