Sunday, 12 September 2021

get src by id

for dyanmic images display image on popup 


 function showImage(i) {

  

   

        var img = document.getElementById('img_'+i);

        img.className = 'element';


        var modalImg = document.getElementById("img01");

        var captionText = document.getElementById("caption");


        modal.style.display = "block";

        modalImg.src = img.currentSrc;

        captionText.innerHTML = this.alt;

    }


read this link to know how to access the subnode of each element

for example get src.



No comments:

Post a Comment

7 Common mistakes in Dot Net — You can avoid

  There are many common mistakes made during .NET (ASP.NET, .NET Core) development, which affect performance, security, and code… Code Crack...