Contents:
.get( index )Returns: Element
Description: Retrieve one of the elements matched by the jQuery object.
-
version added: 1.0.get( index )
-
indexType: IntegerA zero-based integer indicating which element to retrieve.
-
.get()
method grants access to the DOM nodes underlying each jQuery object. If the value of index
is out of bounds — less than the negative number of elements or equal to or greater than the number of elements — it returns undefined
. Consider a simple unordered list:
1
2
3
4
|
|
.get( index )
retrieves a single element:
1
|
|
1
|
|
1
|
|
Example:
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
|
|
Demo:
.get()Returns: Array
Description: Retrieve the elements matched by the jQuery object.
1
2
3
4
|
|
.get()
returns an array of all of the elements:
1
|
|
Example:
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
|
|