简体   繁体   English

jQuery显示下一组元素

[英]jQuery show next set of elements

I am trying to toggle visibility of the following links after I click on the H2 but I keep coming up against a brick wall. 单击H2后,我试图切换以下链接的可见性,但我一直碰到砖墙。

Here is the html and jquery 这是HTML和jQuery

<div class="entry-content cibi">

<h2><strong>Corporate Infrastructure Service Plan</strong></h2>
<p><a href="http://intranet/cibi/files/2014/03/Service-Plan-including-Service-specific-risks-and-all-action-plans-.docx">Service Plan (including Service specific risks and all action plans)</a></p>
<p><a href="http://intranet/cibi/files/2014/03/Scorecard.pdf">Scorecard</a></p>
<p><a href="http://intranet/cibi/files/2014/03/Corporate-Infrastructure-Service-Plan.xls">Corporate Infrastructure Service Plan</a></p>

<h2><strong>Employee Statistics</strong></h2>
<p><a href="http://intranet/cibi/files/2014/03/Absence-Management-Statistics-.xls">Absence Management Statistics</a></p>

</div>

$(document).ready(function(){

$( "h2" ).click(function() {    
    $(this).nextuntil("h2").toggle()
    return false;
});

 });

Can anyone help? 有人可以帮忙吗?

its nextUntil() not nextuntil() nextUntil()不是nextuntil()

$( "h2" ).click(function() {    
$(this).nextUntil("h2").toggle()
return false;
});

Demo 演示版

FIDDLE 小提琴

$(document).ready(function(){
$( "h2" ).click(function() {    
$(this).nextUntill('h2').toggle()
return false;
});
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM