Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

lastChild

« DOM Reference

Summary

lastChild returns the last child of a node.

Syntax

API

var last_child = element.lastChild

Description

The last_child returned is a node. If its parent is an element, then the child is generally an Element node, a Text node, or a Comment node. Returns null if there are no child elements.

Example

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

Specification

Document Tags and Contributors

 Last updated by: Dria,