1. 開発者向けのウェブ技術
  2. Web API
  3. Document
  4. firstElementChild

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

Document: firstElementChild プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2018年4月⁩.

Document.firstElementChild は読み取り専用プロパティで、この文書の最初の子要素 (Element) を返します。子要素がなければ null を返します。

HTML 文書においては、これは普通は唯一の子である、ルートの <html> 要素です。

文書内の特定の要素における最初の子要素については、 Element.firstElementChild を参照してください。

Element オブジェクト、または null です。

js
document.firstElementChild;
// この文書の唯一の子でである、ルート <html> 要素を返す

仕様書

Specification
DOM
# ref-for-dom-parentnode-firstelementchild1

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /