Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

March 08 2010

rogeriopvl

Answer by rogeriopvl for How to create expandable FAQ page in HTML?

Simple example using jQuery:

CSS

.content {
    display: hidden;
}

HTML

<h2>My FAQ</h2>
<a class="faqlink" href="#">Link 1</a>
<div class="content">lorem ipsum</div>
<a class="faqlink" href="#">Link 2</a>
<div class="content">lorem ipsum</div>
<a class="faqlink" href="#">Link 3</a>
<div class="content">lorem ipsum</div>

Javascript/jQuery

$(document).ready(function(){
    $('.faqlink').click(function(){
        $('.content').hide();
        $(this).next('.content').show();
    });
});