const addReqButton = document.getElementById("addReqButton"); const addReqContainerTemplate = document.getElementById("addReqContainerTemplate"); const addReqContainer = document.getElementById("addReqContainer"); addReqButton.addEventListener("click", function () { // Clone the template and remove the "hidden" class const newContainer = addReqContainerTemplate.cloneNode(true); newContainer.classList.remove("hidden"); // Add an event listener to the new container's remove button const removeReqButton = newContainer.querySelector("#removeReqButton"); removeReqButton.addEventListener("click", function () { // Remove the clicked container when the remove button is clicked newContainer.remove(); }); addReqContainer.appendChild(newContainer); });