开发者

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();
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜