You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: entries/index.xml
+99-46Lines changed: 99 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -32,45 +32,47 @@
32
32
<li id="bar">bar</li>
33
33
<li id="baz">baz</li>
34
34
</ul>
35
-
</code></pre>
35
+
</code></pre>
36
36
<p>If we retrieve one of the three list items (for example, through a DOM function or as the context to an event handler), <code>.index()</code> can search for this list item within the set of matched elements:</p>
37
37
<pre><code>
38
-
var listItem = document.getElementById('bar');
39
-
alert('Index: ' + $('li').index(listItem));
40
-
We get back the zero-based position of the list item:
41
-
</code></pre>
38
+
var listItem = document.getElementById( "bar" );
39
+
alert( "Index: " + $( "li" ).index(listItem ) );
40
+
</code></pre>
41
+
<p>We get back the zero-based position of the list item:</p>
42
42
<p>
43
43
<samp>Index: 1</samp>
44
44
</p>
45
45
<p>Similarly, if we retrieve a jQuery object consisting of one of the three list items, <code>.index()</code> will search for that list item:</p>
46
46
<pre><code>
47
-
var listItem = $('#bar');
48
-
alert('Index: ' + $('li').index(listItem));
49
-
</code></pre>
47
+
var listItem = $( "#bar" );
48
+
alert( "Index: " + $( "li" ).index(listItem ) );
49
+
</code></pre>
50
50
<p>We get back the zero-based position of the list item:</p>
51
51
<p>
52
52
<samp>Index: 1</samp>
53
53
</p>
54
54
<p>Note that if the jQuery collection used as the <code>.index()</code> method's argument contains more than one element, the first element within the matched set of elements will be used.</p>
55
55
<pre><code>
56
-
var listItems = $('li:gt(0)');
57
-
alert('Index: ' + $('li').index(listItems));
58
-
</code></pre>
56
+
var listItems = $( "li:gt(0)" );
57
+
alert( "Index: " + $( "li" ).index(listItems ) );
58
+
</code></pre>
59
59
<p>We get back the zero-based position of the first list item within the matched set:</p>
60
60
<p>
61
61
<samp>Index: 1</samp>
62
62
</p>
63
63
<p>If we use a string as the <code>.index()</code> method's argument, it is interpreted as a jQuery selector string. The first element among the object's matched elements which also matches this selector is located.</p>
64
64
<pre><code>
65
-
var listItem = $('#bar');
66
-
alert('Index: ' + listItem.index('li'));
67
-
</code></pre>
65
+
var listItem = $( "#bar" );
66
+
alert( "Index: " + listItem.index( "li" ) );
67
+
</code></pre>
68
68
<p>We get back the zero-based position of the list item:</p>
69
69
<p>
70
70
<samp>Index: 1</samp>
71
71
</p>
72
72
<p>If we omit the argument, <code>.index()</code> will return the position of the first element within the set of matched elements in relation to its siblings:</p>
Copy file name to clipboardExpand all lines: entries/innerHeight.xml
+17-6Lines changed: 17 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -7,20 +7,31 @@
7
7
<desc>Get the current computed height for the first element in the set of matched elements, including padding but not border.</desc>
8
8
<longdesc>
9
9
<p>This method returns the height of the element, including top and bottom padding, in pixels.</p>
10
-
<p>This method is not applicable to <code>window</code> and <code>document</code> objects; for these, use <code><ahref="/height">.height()</a></code> instead.</p>
10
+
<p>This method is not applicable to <code>window</code> and <code>document</code> objects; for these, use <code><ahref="/height/">.height()</a></code> instead.</p>
0 commit comments