Greater than (:gt(n))
In this chapter you will learn:
Description and Syntax
$(':gt(index)')
Select all elements at an index greater than n within the matched set.
$('li:gt(2)')
selects all<li>
elements following the third one$('.myclass:gt(1)')
selects all elements with the class myclass following the second one
Examples
The following code selects the second table row.
<html><!-- j a v a 2 s .c o m-->
<head>
<script src="http://java2s.com/style/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("tr:gt(1)").css("background-color", "red");
});
</script>
</head>
<body>
<body>
<table border="1">
<tr><td>TD #0</td><td>TD #1</td><td>TD #2</td></tr>
<tr><td>TD #3</td><td>TD #4</td><td>TD #5</td></tr>
<tr><td>TD #6</td><td>TD #7</td><td>TD #8</td></tr>
</table>
</body>
</html>
Next chapter...
What you will learn in the next chapter: