How to display/hide text on a web page using openClose in HTML

I am trying to create a FAQ page where the answers to the FAQ will appear if you click on the question. The FAQ are in a numbered list. I figured out that openClose must be used, so I have something like this:

<div onClick="openClose('Answer1')" ><<li><span class="style_bold" >Question 1 here.</span></li>
<div id="Answer1" class="style_bold" ><p>Answer 1. </p></div>
<hr />

Clicking on a question should make the answer to the question visible. Clicking on another question should close the first answer and open the appropriate answer.

Thanks
LVL 8
stevepcguyAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
KGNicklConnect With a Mentor Commented:
You will need to use both CSS and Javascript. The link below has both code and working examples:

http://www.cssnewbie.com/showhide-content-css-javascript/
0
 
stevepcguyAuthor Commented:
Thanks very much! Perfect for me. I was able to learn from this page.

Sometimes a link to an excellent page is all it takes.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.