gt selectorversion deprecated: 3.4
Description: Select all elements at an index greater than index
within the matched set.
-
version added: 1.0jQuery( ":gt(index)" )
index: Zero-based index.
-
version added: 1.8jQuery( ":gt(-index)" )
indexFromEnd: Zero-based index, counting backwards from the last element.
:gt
pseudo-class is deprecated. Remove it from your selectors and filter the results later using .slice()
. For example, :gt(3)
can be replaced with a call to .slice( 4 )
(the provided index needs to be increased by one).
.myclass
) and four elements are returned, these elements are given indices 0 through 3 for the purposes of these selectors.
$( ".myclass:gt(1)" )
selects elements after the second element in the document with the class myclass
, rather than after the first. In contrast, :nth-child(n)
uses 1-based indexing to conform to the CSS specification.
:gt(index)
selector did not accept a negative value for index
Additional Notes:
-
Because
:gt()
is a jQuery extension and not part of the CSS specification, queries using:gt()
cannot take advantage of the performance boost provided by the native DOMquerySelectorAll()
method. For better performance in modern browsers, use$("your-pure-css-selector").slice(index)
instead.
Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
|