I have some javascript code for a FAQ page for my site. So, you click on the question and the answer appears. NOW, what I can't figure out is when I have clicked on one question and that is open, when I click on another I want the previous one to close. Basically, so there is only ever ONE open at a time. Found similar code, but not exactly what I'm looking for.
Any help would be great, here's my code. THANKS!!!! Kait
<script type="text/javascript">
function unhide(divID) {
var item = document.getElementById(divID);
if (item) {
item.className=(item.className=='hidden')?'unhidden':'hidden';
}
}
</script>
<p><a href="javascript:unhide('q1');">Here is my Question???</a></p>
<div id="q1" class="hidden">
<p>The Answer goes here.</p>
</div>
<p><a href="javascript:unhide('q2');">Here is my 2nd Question???</a></p>
<div id="q2" class="hidden">
<p>The 2nd Answer goes here.</p>
</div>