JSFiddle - React, Tailwind, and code Playground
HTML
<div id="tbl">
Here is a whole bunch of content that we want to hide
</div>
<a href="javascript:sizeTbl()"><span id="toggle-table">hide</span></a>
JavaScript
function sizeTbl() {
var tbl = document.getElementById('tbl');
var icon = document.getElementById('toggle-table');
if (icon.innerText === 'show'){
tbl.style.display = 'block';
icon.innerText = 'hide';
}
else {
tbl.style.display = 'none';
icon.innerText = 'show';
}
}