This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

lastChild

Summary

Gets a reference to the last child in the childNodes collection of an object.

Property of dom/Nodedom/Node

Syntax

var result = element.lastChild;
element.lastChild = value;

Examples

The following code example implements the lastChild property to obtain a reference to the last child element of an object.

<body>
<ul id = "oList">
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
</ul>
<script type="text/javascript">
var olastChild = oList.lastChild;
</script>
<body>

Usage

 Used to remove and append nodes to user lists and tables.

Syntax

var last_child = element.lastChild

Standards information

Related specifications

DOM Level 2 Core
Recommendation

Attributions