<html>
<head>
<title></title>
<meta charset='utf-8' />
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
</head>
<body>
<table id="table">
<thead>
<tr>
<th>水果</th>
<th>肉类</th>
<th>蔬菜</th>
</tr>
</thead>
<tbody>
<tr>
<td>香蕉</td>
<td>猪肉</td>
<td>青椒</td>
</tr>
</tbody>
</table>
<div>hello world</div>
<span>heihei</span>
<script type="text/javascript">
jQuery(document).ready(function(){
$("thead tr", "#table").each(function(){
$(this).css("color","red");
});
$("div, span").css("color","red");
});
</script>
</body>
</html>
这里(“thead tr”, “#table”)代表的是匹配两者的交集,
而(“div, span”)代表的是匹配选择器中所有匹配到的的元素。