I've 6 div and I need that when I click in one div, appear a popup in this div, and if I click another div appear a popup in this other div. I know how to do that in one div, with getElementById, but I don't know how do that in some different div. This is my code:
HTML:
<div class="novels__gallery popup" onclick="popupFunction()">
<img class="novels__gallery-img" src="images/fantasia.jpg" alt="Camí fantàstic" title="Camí fantàstic">
<div class="novels__gallery-title">Fantasia</div>
<span class="popupText" id="myPopup">Coming Soon!</span>
</div>
JS:
function popupFunction() {
var popup = document.getElementById("myPopup");
popup.classList.toggle("show");
}
This works for one div, but don't for another div. I supose that getElementsByClassName works but I don't know how to apply correctly it.
Thanks!!