http://jsfiddle.net/KevinOrin/xycCx/1/
jQuery('.happening-main-text .readmore').click(function() {
jQuery('.divmore').toggle('slow');
return false;
});
我试图让每个链接只显示/隐藏点击的那个。我怎样才能修改 JS 来做到这一点。我试过('.happening-main-text').closest('divmore')
了,但也没有用。
<div class="happening-main-text">
<p>part of text goes here part of text <a href="#" class="readmore">show/hide</a>
</p>
<div class="divmore">
<p>more test from hidden1</p>
</div>
</div>
<div class="happening-main-text">
<p>part of text goes here part of text <a href="#" class="readmore">show/hide</a>
</p>
<div class="divmore">
<p>more test from hidden</p>
</div>
</div>
<div class="happening-main-text">
<p>part of text goes here part of text <a href="#" class="readmore">show/hide</a>
</p>
<div class="divmore">
<p>more test from hidden2</p>
</div>
</div>