JSFiddle - React, Tailwind, and code Playground

by George Berkeley

HTML

<div id="divPrincipal" class="divPrincipal">
  
    <div id="div-1" class="divs">
    </div>
    
    <div id="div-2" class="divs">
    </div>
    
    <div id="div-3" class="divs">
    </div>
  
  </div>
  

  <input type="button" value="Visivility a todos los div's!" onclick="c()" />

CSS

html, body {width:100%; height:100%;}

.divPrincipal {
	position:relative;
	top:0;
	left:0;
	width:100%;
	height:20%;
}
.divs {
	position:relative;
	top:0;
	left:0;
	width:30%;
	height:100%;
	margin:3px;
	background-color:navy;
	float:left;
	
	visibility:hidden;
}

JavaScript

function c()
  {
	  var x = document.getElementById("divPrincipal").childNodes.length;
	  var y = document.getElementById("divPrincipal").childNodes;
	  
	  for ( i=0; i<x; i++ )
	  {
		  if ( i != -1 )
		  {
			  y[i].style.visibility = "visible";
		  }
	  }
  }