所以下面的代码只适用于第一个元素'GALLERYTITLE',
$(function(){$("#diradd").click(function(event)
{event.preventDefault();$("#diraddform").slideToggle();});});
HTML:
<!--stuff before-->
<div class="gallerytitle"
<a href="#"class="options" id="diradd" >Add new sub-gallery</a> <!--"button"-->
<!--another stuff divs, buttons etc.-->
<div id="diraddform">
<!--things in this div-->
</div></div> <!--the end of #1 gallerytitle div-->
<div class="gallerytitle"
<a href="#"class="options" id="diradd" >Add new sub-gallery</a> <!--"button"-->
<!--another stuff divs, buttons etc.-->
<div id="diraddform">
<!--things in this div-->
</div>
</div> <!--the end of #2 gallerytitle div-->
CSS:
diraddform{
display:none;}
但我不能使用 .next(); 因为我的“按钮”后面有 div