Node: lastChild プロパティ
lastChild は Node インターフェイスの読み取り専用プロパティで、このノードの最後の子ノードを返します。子ノードがない場合は null を返します。
メモ: このプロパティは、このノードの最後の子ノードである任意の種類のノードを返す。
Text や Comment ノードである可能性があります。
他の要素の子である最後の Element を取得したい場合は、Element.lastElementChild の使用を検討してください。
Value
このノードの最後の子である Node、または子ノードがなければ null です。
例
js
const tr = document.getElementById("row1");
const corner_td = tr.lastChild;
仕様書
| Specification |
|---|
| DOM Standard # ref-for-dom-node-lastchild① |
ブラウザーの互換性
BCD tables only load in the browser