<h1 class='c'>This is a heading</h1>
<p class='b'>The first paragraph.</p>
<p class='aa'>The second paragraph.</p>
<p class='aa'>The third paragraph.</p>
<p class='aa'>The fourth paragraph.</p>
我想选择类名为aa的第一个元素,怎么选择? p.aa:nth-of-type(1) 好像不管用
<h1 class='c'>This is a heading</h1>
<p class='b'>The first paragraph.</p>
<p class='aa'>The second paragraph.</p>
<p class='aa'>The third paragraph.</p>
<p class='aa'>The fourth paragraph.</p>
我想选择类名为aa的第一个元素,怎么选择? p.aa:nth-of-type(1) 好像不管用
<script>
document.getElementsByClassName('aa')[0].style.color="blue";
</script>