snipt

Ctrl+h for KB shortcuts

Text only

twig zebra

<li class="{{ cycle(['even','odd'],loop.index) }}">
https://snipt.net/embed/110f51fc6f3ab4072625205c51b383c3/
https://snipt.net/raw/110f51fc6f3ab4072625205c51b383c3/
110f51fc6f3ab4072625205c51b383c3
text
Text only
1
2016-09-25T00:20:09
True
False
False
Oct 25, 2012 at 05:59 PM
/api/public/snipt/49065/
twig-zebra
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>&lt;li class=&quot;{{ cycle([&#39;even&#39;,&#39;odd&#39;],loop.index) }}&quot;&gt; </span></pre></div> </td></tr></table>
even, odd, symfony2, twig, zebra

JavaScript

selecting even rows

1
2
3
$(document).ready(function() {
alert($('#celebs tbody tr:even').length + ' elements!');
});
https://snipt.net/embed/abb94f70eb5f9a2b60eea1429009f5c4/
https://snipt.net/raw/abb94f70eb5f9a2b60eea1429009f5c4/
abb94f70eb5f9a2b60eea1429009f5c4
js
JavaScript
3
2016-09-22T15:13:51
True
False
False
/api/public/snipt/17758/
selecting-even-rows
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">ready</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">alert</span><span class="p">(</span><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;#celebs tbody tr:even&#39;</span><span class="p">).</span><span class="nx">length</span> <span class="o">+</span> <span class="s1">&#39; elements!&#39;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
even, jquery, table
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.