document.addEventListener("DOMContentLoaded", function () { console.log("El DOM está listo. Ejecutando script..."); }); function showToast(message, type = 'success') { const toastContainer = document.getElementById('toast-container'); const toastId = `toast-${Date.now()}`; const toastHTML = ` `; toastContainer.insertAdjacentHTML('beforeend', toastHTML); const toastElement = document.getElementById(toastId); const toast = new bootstrap.Toast(toastElement); toast.show(); // Elimina el toast del DOM cuando se oculta toastElement.addEventListener('hidden.bs.toast', () => { toastElement.remove(); }); }