/ Published in: JavaScript
The following code can be used to hide content or it's great for FAQ section. Note - the script goes in the head and the list goes in the body.
Expand |
Embed | Plain Text
<script language="javascript"> function togglediv(divid){ if(document.getElementById(divid).style.display == 'none'){ document.getElementById(divid).style.display = 'block'; }else{ document.getElementById(divid).style.display = 'none'; } } </script> <!-- The following list codes goes in the body where you want the content --> <ul> <li> <a href="javascript:;" onclick="togglediv('tag1');">Title Goes Here</a> <div id="tag1" style="padding-top: 5px; margin-top: 5px; padding-bottom: 10px; margin-bottom: 10px; border-bottom-color: #cccccc; border-bottom-width: 1px; border-bottom-style: solid; display: none;"> <p>Content goes in here.</p> </div> </li> </ul>
You need to login to post a comment.
