jquery hide and show

Dobby

Member
Nov 8, 2010
156
5
I cannot get this to work for the life of me. Someone please help

Code:
<html>
<dl id="faqs">
<dt>Question 1</dt>
<dd>Lorem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit</dd>
<dt>Question 2</dt>
<dd>Lorem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit</dd>
<dt>Question 3</dt>
<dd>Lorem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit</dd>
</dl>
<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery("#faqs dd").hide();
        jQuery("#faqs dt").click(function () {
            jQuery(this).next("#faqs dd").slideToggle(500);
            jQuery(this).toggleClass("expanded");
        });
    });
</script>

<style>
#faqs dt, #faqs dd { padding: 0 0 0 50px }
#faqs dt { font-size:1.5em; color: #9d9d9d; cursor: pointer; height: 37px; line-height: 37px; margin: 0 0 15px 25px}
#faqs dd { font-size: 1em; margin: 0 0 20px 25px}
#faqs dt { background: url(http://www.designonslaught.com/files/2012/06/expand-icon.png) no-repeat left}
#faqs .expanded { background: url(http://www.designonslaught.com/files/2012/06/expanded-icon.png) no-repeat left}
</style>
</html>

From

But i cant get it to work :/
 
Last edited by a moderator:

Users who are viewing this thread

Top