Subclass selectors and descendant selectors

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title> Subclass selector and descendant selector </ title>
</head>
<body>
	<div id="father">
		<div>11</div>
		<div>22
			<p>111</p>
			<p>222</p>
			<p>333</p>
		</div>
		<div>33</div>
		<div>44</div>
		<div>55</div>
		<p>66</p>
		<p>77</p>
		<p>88</p>
	</div>
	<script src="jquery-1.12.4.js"></script>
	<script>
		$(function(){
			// $ ("s1, s2") // Union selector
			// $ ("s1 s2") // Descendant selector
			// $ ("s1> s2") // Subband selector
			// $("li.green")
			// $ ("s1s2") // Intersection selector
			$("#father p").css("backgroundColor","red");
		});
	</script>
</body>
</html>

  

Guess you like

Origin www.cnblogs.com/luwn/p/12705414.html
Recommended