JSFiddle - React, Tailwind, and code Playground

by Ben Clayton

HTML

<div class="random random-1">
ONE
</div>

<div class="random random-2">
TWO
</div>


<div class="random random-3">
THREE
</div>

CSS

.random {
  display:none;
}

JavaScript

$(document).ready(function(){

	// generate a random number between 1 and the number of objects.
  var n = $(".random").length;
	var r = parseInt((Math.random() * n) + 1 );
  
  $(".random-"+r).show();// show just one of the objects
    
})