I am using Bootstrap's JS (https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha2/js/bootstrap.bundle.min.js) and I have this modal, which pops up both on adding new things and editing those things. When I click add button (basically submit) I am expecting modal to close fully, but what happens when I include this JS version is that modal disappear, but after that everything becomes unclickable on web-page.
After a bit of digging I've found out that the problem occurs when I use Bootstrap's JS and when I exclude that script it just works fine. This CDN - Also linked at the start of this Question
Here's my code:
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();
}
});