特定の型に一致する親の最初の要素を選択したい。に相当する CSS $(parent).children()[0]
。たとえばh1
、親の最初の子であるタグ:
<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>
編集「親」セレクターがないことは承知しています。