用$("p+").css("background-color","red");这段代码,效果一样哦,不知道有什么弊病不?
<!DOCTYPE html>
<html>
<head>
<title>prev + next选择器</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
码农家族
<label></label>
<p></p>
<label></label>
<label></label>
</div>
<label></label>
<script type="text/javascript">
$("p+label").css("background-color","red");
//$("p+").css("background-color","red");效果一样哦,不知道有什么弊病不?
</script>
</body>
</html>