forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass-selector.xml
59 lines (59 loc) · 1.7 KB
/
class-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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0"?>
<entry type="selector" name="class" return="">
<title>Class Selector (".class")</title>
<sample>.class</sample>
<signature>
<added>1.0</added>
<argument name="class" type="String">
<desc>A class to search for. An element can have multiple classes; only one of them must match.</desc>
</argument>
</signature>
<desc>Selects all elements with the given class. </desc>
<longdesc>
<p>For class selectors, jQuery uses JavaScript's native <code>getElementsByClassName()</code> function if the browser supports it.</p>
</longdesc>
<example>
<desc>Finds the element with the class "myClass".</desc>
<code><![CDATA[
$( ".myClass" ).css( "border", "3px solid red" );
]]></code>
<html><![CDATA[
<div class="notMe">div class="notMe"</div>
<div class="myClass">div class="myClass"</div>
<span class="myClass">span class="myClass"</span>
]]></html>
<css><![CDATA[
div, span {
width: 120px;
height: 40px;
float: left;
padding: 10px;
margin: 10px;
background-color: #EEEEEE;
}
]]></css>
</example>
<example>
<desc>Finds the element with both "myclass" and "otherclass" classes.</desc>
<code><![CDATA[
$( ".myclass.otherclass" ).css( "border", "13px solid red" );
]]></code>
<html><![CDATA[
<div class="myclass">div class="notMe"</div>
<div class="myclass otherclass">div class="myClass"</div>
<span class="myclass otherclass">span class="myClass"</span>
]]></html>
<css><![CDATA[
div, span {
width: 120px;
height: 40px;
float: left;
padding: 10px;
margin: 10px;
background-color: #EEEEEE;
}
]]></css>
</example>
<category slug="selectors/basic-css-selectors"/>
<category slug="version/1.0"/>
</entry>