snipt

Ctrl+h for KB shortcuts

JavaScript

hide/show FAQs in <dl>

$('dd').toggle();
$('dt').click(function() {$(this).next('dd').toggle('slideDown');});
https://snipt.net/embed/5e412c1bc3e0140ac4bfaae4fec128d4/
/raw/5e412c1bc3e0140ac4bfaae4fec128d4/
5e412c1bc3e0140ac4bfaae4fec128d4
js
JavaScript
2
2019-07-21T05:06:21
True
False
False
/api/public/snipt/7087/
hideshow-faqs-in-dl
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;dd&#39;</span><span class="p">).</span><span class="nx">toggle</span><span class="p">();</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;dt&#39;</span><span class="p">).</span><span class="nx">click</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span><span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">next</span><span class="p">(</span><span class="s1">&#39;dd&#39;</span><span class="p">).</span><span class="nx">toggle</span><span class="p">(</span><span class="s1">&#39;slideDown&#39;</span><span class="p">);});</span> </span></pre></div> </td></tr></table>
jquery, list, toggle