Node.lastChild read-only property returns the last child of the node. If its parent is an element, then the child is generally an element node, a text node, or a comment node. It returns null if there are no child elements.

句法

var childNode = node.lastChild;
					

范例

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

规范

规范 状态 注释
DOM
The definition of 'Node.lastChild' in that specification.
实时标准 无变化
DOM (文档对象模型) 3 级核心规范
The definition of 'Node.lastChild' in that specification.
过时 无变化
DOM (文档对象模型) 级别 2 核心规范
The definition of 'Node.lastChild' in that specification.
过时 无变化
DOM (文档对象模型) 1 级规范
The definition of 'Node.lastChild' in that specification.
过时 初始定义

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
lastChild Chrome Yes Edge 12 Firefox 1 IE Yes Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 45 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes

图例

完整支持

完整支持

元数据

  • 最后修改: