forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfirst-selector.xml
More file actions
36 lines (36 loc) · 1.15 KB
/
first-selector.xml
File metadata and controls
36 lines (36 loc) · 1.15 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
<?xml version="1.0"?>
<entry type="selector" name="first" return="">
<title>:first Selector</title>
<sample>:first</sample>
<signature>
<added>1.0</added>
</signature>
<desc>Selects the first matched DOM element.</desc>
<longdesc>
<p>The <code>:first</code> pseudo-class is equivalent to <code>:eq( 0 )</code>. It could also be written as <code>:lt( 1 )</code>. While this matches only a single element, <a href="/first-child-selector/">:first-child</a> can match more than one: One for each parent.</p>
</longdesc>
<note id="jquery-selector-extension" type="additional" data-selector=":first"/>
<note id="document-order" type="additional"/>
<example>
<desc>Finds the first table row.</desc>
<code><![CDATA[
$( "tr:first" ).css( "font-style", "italic" );
]]></code>
<css><![CDATA[
td {
color: blue;
font-weight: bold;
}
]]></css>
<html><![CDATA[
<table>
<tr><td>Row 1</td></tr>
<tr><td>Row 2</td></tr>
<tr><td>Row 3</td></tr>
</table>
]]></html>
</example>
<category slug="selectors/basic-filter-selectors"/>
<category slug="selectors/jquery-selector-extensions"/>
<category slug="version/1.0"/>
</entry>