JSFiddle - React, Tailwind, and code Playground

by Niffler

HTML

<div id="topBar"> 
    <a href ="#" onclick="foo()"> URLs </a>
</div>

<div id="content"> </div>

<div id="txt"> </div>

<div id="test"> 
    <img class="gallery" id="gallery" src="http://dummyimage.com/100x100/ddd/333.png" border="0" />
    <img class="gallery" src="http://dummyimage.com/100x100/ddd/333.png" border="0" /> 
</div>

JavaScript

function foo()
{
    x = document.getElementsByClassName("gallery");
    txt = '';
    for (i = 0; i < x.length; i++) {
        txt = txt + x[i].src + "<br>";
    }
    document.getElementById("txt").innerHTML = txt;
}