JSFiddle - React, Tailwind, and code Playground
HTML
<div class="hide">
<div id="lightbox1">LB1</div>
<div id="lightbox2">LB2</div>
<div id="lightbox3">LB3</div>
<div id="lightbox4">LB4</div>
<div id="lightbox5">LB5</div>
</div>
<a href="#">CLICK ME</a>
JavaScript
function Shuffle(o) {
for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
};
var array = $(".hide div").toArray(); // Add all divs within the hide div to an array
var randomArray = Shuffle(array); // Shuffle the array
$("a").click(function() {
if (randomArray.length > 0)
alert(randomArray.shift().innerHTML); // Show contents of div, as an example
else
alert("None left!");
return false;
});