Feel free to check out a sample of my page here: . My goal is to load the MEC div and then close it when clicking on another link, like Minimum Value Plans in the top bar. I experimented with setting it to "display:block" instead of "display:none", but unfortunately, this approach doesn't allow me to close it.
Displayed below is the JavaScript code that I am currently using:
lastone = 'empty';
function showIt(lyr) {
if (lastone !== 'empty') lastone.style.display = 'none';
lastone = document.getElementById(lyr);
lastone.style.display = 'block';
};
function hideIt(lyr) {
if (lastone !== 'empty') lastone.style.display = 'block';
lastone = document.getElementById(lyr);
lastone.style.display = 'none';
}
Additionally, here is an example of the link code:
<a href="JavaScript:"showonlyone";" onClick="showIt('MEC')" class="homeheader">MEC Plans
<div id="MEC" style="display:none;">
<p class=textwhheader>MEC Plans enable employers to provide qualifying coverage to their employees on a self-funded basis, satisfying the individual mandate.
</p>
<br>
<a id='register'
class="btn red pure-button pure-button-primary"
style="font-size:13.33px; font-weight:700; line-height:26px; height:24px;vertical-align:middle;"
href='mecplans.html'
title="Click here to learn more.">
Learn More
</a>
</div>