Hello! Situation: there is a one-page page, among which there are 5 absolutely identical blocks with a button (the button has the same class - .btn_sign). Pressing the button should invoke a modal window.
I can not figure out how to make each of the .btn_sign buttons invoke the .modal-window_entry window. So far, I am only learning the basics of JS, so I'm dumb. Help me please)
Below is the code that calls the modal window by pressing only the first button.
var openModalEntry = document.querySelector(".btn_sign"); var showModalEntry = document.querySelector(".modal-window_entry"); var closeModalEntry = showModalEntry.querySelector(".close-entry"); openModalEntry.addEventListener("click", function(event) { event.preventDefault(); showModalEntry.classList.add("show-entry"); }); closeModalEntry.addEventListener("click", function(event) { event.preventDefault(); showModalEntry.classList.remove("show-entry"); })