I have several sections of content on my site that are default 'hidden' in CSS. I use the getElementById so visitors can open each section of content individually. I now would like to add the option to open ALL content at once. All sections are contained in <div> tags with the class="show". How could I do this with getElementsByClassName?
Here's what I have so far:
function showHideAll(className) {
document.getElementsByClassName(className).style.display = 'block';
}
<a href="#" id="showAll" class="showLink" onclick="showAll('show');return false;">SHOW ALL CONTENT</a>
<div id="content" class="show">CONTENT 1</div>
<div id="content2" class="show">CONTENT 2</div>
<div id="content3" class="show">CONTENT 3</div>
EXAMPLE PAGE:
http://carevealed.com/cc.php