Document: lastElementChild プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Document.lastElementChild は読み取り専用プロパティで、この文書の最後の子要素 (Element)、または子要素がない場合は null を返します。

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

文書内の固有の要素の最後の子要素については Element.lastElementChild を参照してください。

ルート <html> 要素です。

js
document.lastElementChild;
// 文書のただ一つの子であるルート <html> 要素を返す

仕様書

Specification
DOM
# ref-for-dom-parentnode-lastelementchild①

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
lastElementChild

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報