I want to select the first element of a parent matching a specific type; the css equivalent of $(parent).children()[0]
. For example, h1
tags that are the first child of a parent:
<div>
<h1 id="foo"></h1> // match
<div></div> // not match
…
</div>
<section>
<h1 id="bar"></h1> // match
<div></div> // not match
…
</section>
<div>
<div id="baz"></div> // not match
<h1 id="qux"></h1> // not match
…
</div>
EDIT I am aware that there is no 'parent' selector.