-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy patheven.xml
More file actions
47 lines (47 loc) · 1.46 KB
/
even.xml
File metadata and controls
47 lines (47 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version="1.0"?>
<entry type="method" name="even" return="jQuery">
<title>.even()</title>
<signature>
<added>3.5</added>
</signature>
<desc>Reduce the set of matched elements to the even ones in the set, numbered from zero.</desc>
<longdesc>
<p>Given a jQuery object that represents a set of DOM elements, the <code>.even()</code> method constructs a new jQuery object from the even elements in that set. Counting starts from zero!</p>
<p>Consider a page with a simple list on it:</p>
<pre><code>
<ul>
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
<li>list item 4</li>
<li>list item 5</li>
</ul>
</code></pre>
<p>We can apply this method to the set of list items:</p>
<pre><code>
$( "li" ).even().css( "background-color", "red" );
</code></pre>
<p>The result of this call is a red background for the first, third & 5th items.</p>
</longdesc>
<example>
<desc>Highlight the even items in a list.</desc>
<css><![CDATA[
.highlight {
background-color: yellow;
}
]]></css>
<code><![CDATA[
$( "ul li" ).even().addClass( "highlight" );
]]></code>
<html><![CDATA[
<ul>
<li>Look:</li>
<li>This is some text in a list.</li>
<li>This is a note about it.</li>
<li>This is another note about it.</li>
</ul>
]]></html>
</example>
<category slug="traversing/filtering"/>
<category slug="version/3.5"/>
</entry>