JQUERY1.9学习笔记 之基本过滤器(三)偶数选择器

偶数选择器 jQuery( ":even" )

例:查询偶数个表格的行。

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<title>even demo</title>
<style>
table{
background:#eee;
}
</style>
<script src="js/jquery-1.9.1.min.js"></script>
</head>
<body>
<table border="1">
<tr><td>Row with Index #0</td></tr>
<tr><td>Row with Index #1</td></tr>
<tr><td>Row with Index #2</td></tr>
<tr><td>Row with Index #3</td></tr>
</table>
<script>
$("tr:even").css("background-color","#bbf");
</script>
</body>
</html>

原文地址:https://www.cnblogs.com/semcoding/p/3519435.html