Jquery slidetoggle was working now not
I have the following structure:
<div class="news">
<p>
summary here<a href="#">more</a>
</p>
<div class="more">
<p>
More News
</p>
</div>
with the following jQuery
$('.news a').click(function(event){
//alert('.news');
$(this).nextAll(开发者_高级运维'.more').slideToggle();
event.preventDefault();
});
For some reason it has stopped working, any ideas
.nextAll()
finds siblings only, but you're inside a <p>
now...so you need to go up one level:
$('.news a').click(function(event){
$(this).parent().nextAll('.more').slideToggle();
event.preventDefault();
});
精彩评论