selector next() how to

selector next() how to

I have the following code:

<div class="prgwrap redlist">
<ul class="prglist">
<li>

<span class="moreinfo">more info</span>

<h3>this is a ttitle</h3>
<b>deelnemers:</b>

<a href="deelnemers.php?prt=4">Jennifer</a>
<a href="deelnemers.php?prt=1">Sandra</a>
<a href="deelnemers.php?prt=3">Kim</a>

<div class="prg_info">
<b>categorie:</b> Dansen op straat
<b>locatie:</b> Lange Poten<br />
<p>Here goes a piece of information</p>
</div>

</li>

<li> ..... </li>

</ul>
</div>

What I'm trying to realize is that when clicking the moreinfo link that de dic with class prg_info opens/closes. I came up with the code below:

$(function () {

$('.prg_info').hide();

$('.moreinfo').click(function() {
$(this).next('.prg_info').slideToggle(300);
});

});

When placing the link direcly above the prg_info div this worked fine. But when placing the open/close link above the H3 tag I dont seen to have the right selector. I assume it is fairly simple to select the prg_info div but I've been trying different ways but haven't succeeded yet. COuld anyine point me in the right direction?

Thanks in advance!

Jerome
    • Topic Participants

    • fuel