Select First Child Elements $(":first-child")

$(":first-child")

e.g. $("span:first-child")

$(":first-child") selects elements if they are first child of their parents.

Example 1: $("li:first-child") will select all <li> elements if they are first child of their parents.
<ul>
<li>1st</li>
<li>2nd</li>
</ul>
    
<ul>
<li>1st</li>
<li>2nd</li>
</ul>
Example 2: $("span:first-child") will find all <span> elements if they are first child of their parents.
<div>
  <p>a</p> // first child but not <span>
  <span>b</span>
  <span>c</span>
</div>
<div>
  <span>d</span>
  <span>e</span>
  <span>f</span>
</div>
jQuery selector filter $(":first-child")