Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:选择器好好学
<div class="mydiv" style="background: #000;" id="div_back">黑色</div>
<div class="mydiv" style="background: #ff0000;" id="div_red">红色</div>
<div class="mydiv" style="background: #00ff00;" id="div_green">
<p id="a">div中的p标签</p>
<div>
<p id="b">div中的div的p标签</p>
<p id="c">p3</p>
</div>
<p id="d">pd</p>
<div style="background: yellow">第二个div</div>
</div>
<p id="4">我是p标签</p>
根据$(‘#ID值’)选择
<script type="text/javascript">
var div = $('#div_back');
console.log(div);
</script>
根据$(‘.类名称’)选择
<script type="text/javascript">
var div = $('.mydiv');
console.log(div);
</script>
选择指定ID为div_green下的所有p标签
<script type="text/javascript">
var div = $('#div_green p');
console.log(div);
</script>
选择指定ID为div_green下的所有子代为p标签
<script type="text/javascript">
var ps = $('#div_green > p');
console.log(ps);
</script>
选择紧跟在p标签后面的一个平级div
<script type="text/javascript">
var div = $('p + div');
console.log(div);
</script>
选择与ID为div_back之后的所有平级的div标签
<script type="text/javascript">
var div = $('#div_back ~ div');
console.log(div);
</script>