<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript" src="../js/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
$(function () {
//为紧接在p元素后的下一个元素设置颜色
$("p").next().css("color","red");
//为div后的所有元素设置颜色
$("div").nextAll().css("color","blue");
})
</script>
</head>
<body>
<p>QQQQQQQQQQQQ</p>
<B>UUUUUUUU</B>
<div>YYYYYYYYY</div>
<span>MMMMMMMM</span>
<span>OOOOOOOO</span>
</body>
</html>