forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheven-selector.xml
36 lines (36 loc) · 1.23 KB
/
even-selector.xml
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
<?xml version="1.0"?>
<entry type="selector" name="even" return="">
<title>:even Selector</title>
<sample>:even</sample>
<signature>
<added>1.0</added>
</signature>
<desc>Selects even elements, zero-indexed. See also <a href="/Selectors/odd/">odd</a>.</desc>
<longdesc>
<p>In particular, note that the <em>0-based indexing</em> means that, counter-intuitively, <code>:even</code> selects the first element, third element, and so on within the matched set.</p>
</longdesc>
<note id="jquery-selector-extension" type="additional" data-selector=":even"/>
<note id="document-order" type="additional"/>
<example>
<desc>Finds even table rows, matching the first, third and so on (index 0, 2, 4 etc.).</desc>
<code><![CDATA[
$( "tr:even" ).css( "background-color", "#bbf" );
]]></code>
<css><![CDATA[
table {
background: #eee;
}
]]></css>
<html><![CDATA[
<table border="1">
<tr><td>Row with Index #0</td></tr>
<tr><td>Row with Index #1</td></tr>
<tr><td>Row with Index #2</td></tr>
<tr><td>Row with Index #3</td></tr>
</table>
]]></html>
</example>
<category slug="selectors/basic-filter-selectors"/>
<category slug="selectors/jquery-selector-extensions"/>
<category slug="version/1.0"/>
</entry>