HTML部分
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
table tr td{
border: 1px solid red;
}
</style>
</head>
<body>
<button class="bianse">变色</button>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>
</body>
<script src="js/jquery.js"></script>
<script src="js/2.js"> </script>
<script >
</script>
</html>
$(document).ready(function () {
$(".bianse").click(function () {
$("table tr").each(function (index) {
if(index == 2){
console.log(index);
$(this).find("td").each(function (index) {
if(index == 2){
console.log(index);
console.log($(this));
}
})
}
})
})
})