- Item 1 (Index 0)
- Item 2 (Index 1)
- Item 3 (Index 2) - Highlighted
- Item 4 (Index 3) - Highlighted
Sel Gt
## jQuery :gt() Selector
The jQuery `:gt()` selector is a built-in index-based filter used to select all elements at an index greater than a specified number.
In jQuery, index numbers are **zero-based**, meaning the first matched element has an index of `0`, the second has an index of `1`, and so on.
---
## Syntax
```javascript
$(":gt(index)")
```
### Parameters
| Parameter | Type | Description |
| :--- | :--- | :--- |
| `index` | Integer | **Required.** Specifies the zero-based index. The selector will match all elements with an index strictly greater than this value. |
---
## Usage and Examples
The `:gt()` selector is most commonly combined with other selectors (such as element selectors or class selectors) to filter a specific subset of elements.
### Example 1: Selecting Table Rows
Select and style all table rows (``) after the first 4 rows (index greater than 3):
```javascript
$(document).ready(function(){
// Selects the 5th table row (index 4) and all subsequent rows
$("tr:gt(3)").css("background-color", "yellow");
});
```
### Example 2: Selecting List Items
Select all list items (``) after the second item (index greater than 1):
```html
YouTip