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 Comment More infoAdvertise with us V Vishal Chaudhary 2 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML DOM click() Method The click() method is used to simulate the mouse click on an element. This method works exactly the same as the element is manually clicked. Syntax: HTMLElementObject.click() Parameters: No parameters required. Return Value: No return value. Example: In this example, when the cursor goes over the ra 1 min read HTML DOM scrollTop Property The DOM scrollTop property is used to return or set the number of pixels an element is scrolled vertically. If the element's content doesn't generate a scroll bar, then its scrollTop value is 0. Syntax: It returns the scrollTop property.element.scrollTopIt is used to set the scrollTop propertyelemen 2 min read HTML DOM isSameNode() Method The isSameNode() method checks whether the two nodes are the same or not. This method is different from isequalNode(), where two different nodes can be equal but not the same, here the same node means that they are referencing the same object. Syntax: node.isSameNode(othernode) Parameters: The "othe 1 min read HTML DOM console timeEnd() Method The console.timeEnd() method in HTML is used to end a timer started by the console.time() method. This can be used to calculate the time of certain operations for testing purposes. Syntax:console.timeEnd( label )Parameters: This method accepts single parameter label which is optional. It is used to 3 min read HTML DOM getAttributeNode() Method The getAttributeNode() method in HTML DOM is used to return the attribute node with the specified name of an element, as an attribute object. This function is similar to the getAttribute() method but the only difference is that the getAttribute() method returns the value of an attribute node, not an 2 min read HTML DOM scrollWidth Property The DOM scrollWidth property is used to return the width of an element. This property includes padding and also content that is not visible on the screen due to overflow but does not include a border, scrollbar, or margin. It is a read-only property. Syntax: element.scrollWidth Return Value: It retu 1 min read HTML DOM cloneNode() Method The HTML DOM cloneNode() Method is used to copy or clone a node on which the cloneNode() method is called. For example, a list item can be copied from one list to another using this method.Syntax: yourNode.cloneNode([deep]) Parameters: The [deep] is an optional argument. We can set its value to "tru 3 min read HTML onunload Event Attribute The onunload event attribute works when the document is being unloaded i.e. it occurs when the browser has been closed. It is mostly used when the user opens a link and submits the form and closes the browser window. Basically, it is: Fired when a user navigates away from a page or closes the browse 1 min read HTML DOM exitFullscreen() Method The exitFullscreen() method requests the element which is currently in full-screen mode to be taken out of full-screen mode. If the element is not in full-screen mode, then nothing gets changed. The reverse of this method is requestFullscreen(). Syntax: HTMLElementObject.exitFullscreen() Parameters: 1 min read HTML DOM children Property The DOM children property is used to return an HTML collection of all the child elements of the specified element. The elements in the collection can be accessed by index numbers. It differs from childNodes as childNodes contain all nodes (i.e. it includes text and comment nodes as well) but on the 2 min read Like