i have two modals in my website when i click on close button of first one it closes but when i click on close button of second button it does not close i have double check the id's and also check througn console.log which is also working on clicking my cloes icon on second modal check repo code"https://github.com/TalhaMustafa1/bootstrap-website.git" but can not find error here is my js code" <script> // Get references to the modals by their unique IDs var modal1 = document.getElementById("myModal"); var modal2 = document.getElementById("Modal");
// Get the buttons that open the modals var btn1 = document.getElementById("myBtn"); var btn2 = document.getElementById("descento-modal");
// Get the <span> elements that close the modals var span1 = document.getElementById("closeModal1"); var span2New = document.getElementById("closeModal2New"); // Change the ID here
// Function to open the first modal btn1.onclick = function () { modal1.style.display = "block"; };
// Function to close the first modal span1.onclick = function () { modal1.style.display = "none"; };
// Function to open the second modal btn2.onclick = function () { modal2.style.display = "block"; };
// Function to close the second modal when "closeModal2New" is clicked span2New.onclick = function () { modal2.style.display = "none"; };
// When the user clicks anywhere outside of the modals, close them window.onclick = function (event) { if (event.target == modal1) { modal1.style.display = "none"; } if (event.target == modal2) { modal2.style.display = "none"; } };