3
Contributors
5
Replies
14
Views
1 Year
Discussion Span
Last Post by garyrichard
1

If I am in the case, I will probably wrap the question and answer in same div. Then use class instead of id, and bind the script to the class.
html:

<div>
    <div class="flip"></div>
    <div class="panel"></div>
</div>

script:

$(document).ready(function(){
    $(".flip").click(function(){
        $(this).sibling(".panel").slideToggle("slow");
    });
});
0

I tried this...But not working anymore...

<script>
    $(document).ready(function(){
        $(".flip").click(function(){
            $(this).sibling(".panel").slideToggle("slow");
        });
    });
</script>
<style> 
#panel, #flip {
    text-align: left;
    background-color:#FFF;
}

#panel {
    text-align:justify;
    display: none;
}
</style>
<div>
        <div class="flip">Question</div>
        <div class="panel">Answer</div>
    </div>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.