[jQuery] Getting the child element on click
Simple stuff here but I'm new to jQuery from Prototype.
My HTML is like this:
<div class="feature">
<h2>Heading Goes Here</h2>
<img src="photo.jpg" />
Text goes here
</div>
// repeat x10
Javascript: (runs on page load)
$('.feature h2').click(function () {
$(this).parent().children("p").slideUp(400);
});
What I want to happen is for the element inside the .feature class
to appear when the <h2> of that <div> is clicked - make sense?
I tried using next() and a few other methods but it doesn't work as
neatly as I want it to - how can I tell jQuery to just return the
element within that div (and not all
elements which are inside
a .feature class)?
Thanks,
Matt