I have this code that I use to elicit answers to some questions in the frequently asked questions section of my website. You click on a question and the div containing the answer is shown below.
It works in Safari, Chrome, Opera, and even in IE, but not in Firefox.
Links just do nothing.
Any ideas why, or any better methods for the FAQ section? I already have jQuery uploaded to my page, if something can be done better with it there, I don’t know. Or a CSS-only solution?
Here is my code:
JS Code:
<script type="text/javascript">
function toggle(tag) {
if (tag.style.display=='') {
tag.style.display='none'
} else {
tag.style.display=''
}
}
</script>
HTML code:
<a href="javascript: toggle(question1)">FAQ Question goes here</a>
<div id="question1" style="display:none">
<p>FAQ Answer goes here</p>
</div
source
share