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>
最近如何?最近的兄弟姐妹?后裔?祖先?谁能告诉你如何选择我们看不到的DOM元素? – 2013-05-11 01:01:25