How can I make only the child of the clicked element slideToggle? I tried implementing a solution, but it ended up sliding all divs with the .description class. Can anyone provide some guidance?
HTML:
<div id="container">
<div class="row">
<div class="item"> <div class="toggle"></div>
<div class="description"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet </div>
</div>
<div class="item"> <div class="toggle"></div>
<div class="description"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea c </div>
</div>
<div class="item"> <div class="toggle"></div>
<div class="description"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, </div>
</div>
</div>
jQuery:
$(document).ready(function(){
$(".toggle").click(function(){
$(this).parent().find(".description").slideToggle();
});
});
CSS:
.row{
width:900px;
}
.toggle{
width:150px;
height:200px;
margin:0 auto;
background:red;
}
.item{
float:left;
width:300px;
text-align:center;
}
.description{
display:none;
text-align:left;
}