2010-11-26 37 views
1

今ではない仕事をしていた:それは動作を停止しましたいくつかの理由について、以下のjQueryjQueryのslidetoggleは、私は次の構造を持っている

$('.news a').click(function(event){ 
//alert('.news'); 
$(this).nextAll('.more').slideToggle(); 
event.preventDefault(); 
}); 

<div class="news"> 

<p> 
    summary here<a href="#">more</a> 
</p> 
<div class="more"> 
<p> 
    More News 
</p> 
</div> 

を、任意のアイデア

答えて

2

.nextAll()は兄弟を発見しますあなたは今すぐ<p>の中にいるので... 1レベル上がる必要があります:

$('.news a').click(function(event){ 
    $(this).parent().nextAll('.more').slideToggle(); 
    event.preventDefault(); 
}); 
+0

乾杯! – Matthew

関連する問題