I have these two divs on a page with two buttons beneath them to control hiding and showing them respectively.
<div class="threeSixtyContainer">
<div class="toggle360" style="display: block;" id="Blue">Im Blue</div>
<div class="toggle360" style="display: none;" id="Red">Im Red</div>
<ul class="flashlinks">
<li id="" class="flashlinks"><a href="#Blue" onclick="toggle_visibility('Blue');">Blue</a></li>
<li id="" class="flashlinks"><a href="#Red" onclick="toggle_visibility('Red');">Red</a></li>
</ul>
</div>
I am using this javascript at the moment on the onclick of link.
function toggle_visibility(id) {
var e = document.getElementById(id);
console.log(e);
if(e.style.display == 'none') {
e.style.display = 'block';
} else {
e.style.display = 'none';
}
}
It works however how do I make it so that clicking one button will disable the other. So clicking blue will show the blue div and hide the red div, then disable the button and enable the other button so the same can be donw but in reverse.
I have made a fiddle with the code i am using on my page which works, but on the fiddle its not? not sure why, ill post it anyway.
EDIT _ Fiddle Now Working. Thanks.