const articleImg = document.querySelectorAll('#myarticle img') for (let i = 0; i < articleImg.length; i++) { articleImg[i].addEventListener("click", function () { window.open(articleImg[i].src, "_blank"); }); }