snipt

Ctrl+h for KB shortcuts

JavaScript

jquery zebra table striping

1
2
3
4
// ===================
// jquery zebra table odd striping

$("tr:nth-child(odd)").addClass("odd");
https://snipt.net/embed/ca663f768a7e8e6ddcb23f5b5cc44935/
/raw/ca663f768a7e8e6ddcb23f5b5cc44935/
ca663f768a7e8e6ddcb23f5b5cc44935
js
JavaScript
4
2019-08-19T17:35:56
True
False
False
/api/public/snipt/8202/
jquery-zebra-table-striping
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">// ===================</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">// jquery zebra table odd striping</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;tr:nth-child(odd)&quot;</span><span class="p">).</span><span class="nx">addClass</span><span class="p">(</span><span class="s2">&quot;odd&quot;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
jquery, striping, tables, zebra