HTML DOM lastElementChild Property Last Updated : 30 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The DOM lastElementChild property is used to return the last child element of the specified element or null if there is no last element. It is similar to the lastChild property but the difference is that the lastChild property returns all last-child nodes i.e. it includes text and comment nodes as well but on the other hand, lastElementChild returns the last node as an element node only. It is a read-only property. Syntax: element.lastElementChild Return Value: It returns an object which represents the last child of an element. If there is no child element then it returns null. Example: In this article, we will use DOM lastElementChild property HTML <!DOCTYPE html> <html> <head> <title> DOM lastElementChild Property </title> </head> <body style="text-align: center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h2> DOM lastElementChild Property </h2> <div id="GFG"> <span>GeeksforGeeks!</span> <span>A computer science portal for geeks.</span> </div> <br> <button onclick="Geeks()"> Click me! </button> <p id="p"></p> <!-- script to find last child element --> <script> function Geeks() { let doc = document.getElementById("GFG").lastElementChild.innerHTML; document.getElementById("p").innerHTML = doc; document.getElementById("p").style.color = "white"; document.getElementById("p").style.background = "green"; } </script> </body> </html> Output: Supported Browsers: The browser supported by DOM lastElementChild property are listed below: Google Chrome 1.0Edge 12.0Internet Explorer 9.0Firefox 3.5Opera 10.0Safari 4.0 Create Quiz Comment V Vishal Chaudhary 2 Follow 0 Improve V Vishal Chaudhary 2 Follow 0 Improve Article Tags : Web Technologies HTML HTML-DOM Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List15+ min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like