Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
¿Por qué modal no quiere cerrarse completamente cuando se usa Bootstrap 5 JS?

Estoy usando JS de Bootstrap ( https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha2/js/bootstrap.bundle.min.js ) y tengo este modal, que aparece tanto al agregar cosas nuevas como al editar esas cosas. Cuando hago clic en el botón Agregar (básicamente, enviar), espero que el modal se cierre por completo, pero lo que sucede cuando incluyo esta versión de JS es que el modal desaparece, pero después de eso, no se puede hacer clic en todo en la página web.

Después de investigar un poco, descubrí que el problema ocurre cuando uso el JS de Bootstrap y cuando excluyo ese script, simplemente funciona bien. Este CDN: también vinculado al comienzo de esta pregunta

Aquí está mi código:

 const addForm = document.getElementById("add-user-form"); const updateForm = document.getElementById("edit-user-form"); const showAlert = document.getElementById("showAlert"); const addModal = new bootstrap.Modal(document.getElementById("addNewUserModal")); const editModal = new bootstrap.Modal(document.getElementById("editUserModal")); const tbody = document.querySelector("tbody"); // Add New User Ajax Request addForm.addEventListener("submit", async (e) => { e.preventDefault(); const formData = new FormData(addForm); formData.append("add", 1); if (addForm.checkValidity() === false) { e.preventDefault(); e.stopPropagation(); addForm.classList.add("was-validated"); return false; } else { document.getElementById("add-user-btn").value = "Molimo sačekajte..."; const data = await fetch("action.php", { method: "POST", body: formData, }); const response = await data.text(); showAlert.innerHTML = response; document.getElementById("add-user-btn").value = "Dodajte vozilo"; addForm.reset(); addForm.classList.remove("was-validated"); addModal.hide(); fetchAllUsers(); } });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!