我的 html 中有这种设置
<section class="grp">
<ul class="normal">
<li>Normal Thing <button class="toggle-advanced">toggle advanced</button></li>
</ul>
<ul class="advanced">
<li>This is Advanced</li>
</ul>
</section>
<h1>Another Thing</h1>
<section class="grp">
<ul class="normal">
<li>Normal Thing <button class="toggle-advanced">toggle advanced</button></li>
</ul>
<ul class="advanced">
<li>This is Advanced</li>
</ul>
</section>
ul
如果单击按钮,如何切换“高级” ul.normal
?
我在coffeescript中这样尝试过
$('.normal').on 'click', '.toggle-advanced', (e) ->
$(@).closest('.grp').siblings('.advanced').slideToggle();