Home >>jQuery Tutorial >jQuery :gt() Selector
jQuery :gt() selector in jQuery is used to selects elements with an index number higher than a specified number and the index numbers start at 0.
Syntax:$(":gt(index)")
Parameter | Description |
---|---|
index | It is a Required parameter and used to specifies which element to select. |
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("tr:gt(3)").css("background-color", "orange");
});
</script>
</head>
<body>
<h1>Welcome to Phptpoint !</h1>
<table border="1">
<tr>
<th>S.No</th>
<th>Country</th>
</tr>
<tr>
<td>1</td>
<td>India</td>
</tr>
<tr>
<td>2</td>
<td>Italy</td>
</tr>
<tr>
<td>3</td>
<td>France</td>
</tr>
<tr>
<td>4</td>
<td>UK</td>
</tr>
<tr>
<td>5</td>
<td>Mexico</td>
</tr>
<tr>
<td>6</td>
<td>Sweden</td>
</tr>
<tr>
<td>7</td>
<td>Germany</td>
</tr>
<tr>
<td>8</td>
<td>Canada</td>
</tr>
</table>
</body>
</html>
S.No | Country |
---|---|
1 | India |
2 | Italy |
3 | France |
4 | UK |
5 | Mexico |
6 | Sweden |
7 | Germany |
8 | Canada |