I’m a beginner . what to add to working with multiple photos. not just 1? (javascript)
Code for modal photos. does not display more than one photo and I do not know how to add “for”.
var modal = document.getElementById('Modalfoto');
var img = document.getElementById('modalfoto');
var modalfoto = document.getElementById("img01");
var capfotoText = document.getElementById("capfoto");
img.onclick = function(img){
modal.style.display = "block";
modalfoto.src = this.src;
capfotoText.innerHTML = this.alt;
capfotoText.innerHTML = this.nextElementSibling.innerHTML;
}
var span = document.getElementsByClassName("closefoto")[0];
span.onclick = function() {
modal.style.display = "none";
}