HTML DOM lastElementChild Property

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








googletag.cmd.push(function() googletag.display('div-gpt-ad-1422003450156-2'); );




HTML DOM lastElementChild Property


Element Object




Example


Get the HTML content of the last child element of an <ul> element:



var x = document.getElementById("myList").lastElementChild.innerHTML;

<!--

The result of x will be:



Tea
-->
Try it Yourself »

More "Try it Yourself" examples below.



Definition and Usage


The lastElementChild property returns the last child element of the specified
element.


The difference between this property and
lastChild, is that lastChild returns
the last child node as an element node, a text node or a comment node
(depending on which one's last), while lastElementChild returns the last
child node as an element node (ignores text and comment nodes).


This property is read-only.


Tip: Use the children
property to return any child element of a specified element.


Tip: To return the first child element of a specified element, use
the firstElementChild property.



Browser Support














Property
lastElementChild 2.0 9.0 3.5 4.0 10.0

Syntax



element.lastElementChild







googletag.cmd.push(function() googletag.display('div-gpt-ad-1493883843099-0'); );





Technical Details






Return Value: A Node object, representing the last child element of an element, or null if there are no child elements
DOM Version Core Level 3 Element Traversal

More Examples




Example


Get the tag name of the last child element of a <div> element:



var x = document.getElementById("myDIV").lastElementChild.tagName;
document.getElementById("demo").innerHTML = x;

<!--

The result of x will be:



SPAN
-->
Try it Yourself »



Example


Get the text of the last child element of a <select> element:



var x = document.getElementById("mySelect").lastElementChild.text;

<!--

The result of x will be:



Volvo
-->
Try it Yourself »


Element Object


Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế