?
This document uses PHP Chinese website manual Release
匹配所給選擇器( :之前的選擇器)的第一個子元素
類似的 :first 匹配第一個元素,但是:first-child選擇器可以匹配多個:即為每個父級元素匹配第一個子元素。這相當(dāng)于:nth-child(1)
在每個 ul 中查找第一個 li
<ul> <li>John</li> <li>Karl</li> <li>Brandon</li> </ul> <ul> <li>Glen</li> <li>Tane</li> <li>Ralph</li> </ul>
$("ul li:first-child")
[ <li>John</li>, <li>Glen</li> ]