当标题是单击内容时,如何切换具有相同类名的特定div显示我有5个具有相同类名称的问题是当我单击其中一个标题时所有内容显示。
<div class="row package-row">
<div class="global-switch">
<input type="checkbox" id="switch1" name="switch1" class="switch" />
<label for="switch1">Hide Packages</label>
</div><!--end of global-switch-->
<div class="col-md-12">
<div class="header-details">
<h3 id="toggle-h3-package">TITLE</h3>
<p>DESCRIPTION</p>
</div>
<div class="global-control" id="global-control">
CONTENT
</div>
</div>
</div>
jQuery代码
$('#toggle-h3-package').click(function(){
$(this).parent().next('.global-control').animate({
height:'toggle',
opacity:'toggle'
},500);
});