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.
lastChild
は Node
インターフェイスの読み取り専用プロパティで、このノードの最後の子ノードを返します。子ノードがない場合は null
を返します。
メモ:
このプロパティは、このノードの最後の子ノードである任意の種類のノードを返す。
Text
や Comment
ノードである可能性があります。
他の要素の子である最後の 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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
lastChild |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.