Node: lastChild プロパティ

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.

lastChildNode インターフェイスの読み取り専用プロパティで、このノードの最後の子ノードを返します。子ノードがない場合は null を返します。

メモ: このプロパティは、このノードの最後の子ノードである任意の種類のノードを返す。 TextComment ノードである可能性があります。 他の要素の子である最後の Element を取得したい場合は、Element.lastElementChild の使用を検討してください。

このノードの最後の子である Node、または子ノードがなければ null です。

js
const tr = document.getElementById("row1");
const corner_td = tr.lastChild;

仕様書

Specification
DOM
# ref-for-dom-node-lastchild①

ブラウザーの互換性

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
lastChild

Legend

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

Full support
Full support

関連情報