JSFiddle - React, Tailwind, and code Playground
HTML
<div id="btcode">boton</div>
<div class="code1"></div>
<div class="code1"></div>
CSS
.code1 {
width:200px;
height:200px;
background-color:#333;
margin:2px;
}
#btcode {
cursor:pointer;
}
JavaScript
var code = document.getElementsByClassName("code1");
btcode = document.getElementById("btcode");
btcode.addEventListener("click", function () {
code.style.width = code.style.width == "100px" ? "200px" : "100px";}, false);;