HTML DOM ownerDocument Property Last Updated : 13 Jun, 2023 Comments Improve Suggest changes 1 Likes Like Report The ownerDocument property returns the top-level document object of the node. Here, the owner document of the node is returned as the document object. It is a read-only property. Syntax: node.ownerDocument; Properties: nodeName property: It returns the name of the specified node. If the node is an element node, it will return the tag name else if the node is an attribute node, it will return the attribute name else for different node types, different names will be returned. syntax: node.ownerDocument.nodeName; Return Value: The owner document of the node, is returned as the document object. Example 1 : Showing nodeName property html <!DOCTYPE html> <html> <body> <h1><center>Geeks <button onclick="node()"> Press </button> </center> </h1> <h4>DOM ownerDocument Property</h4> <p>It returns the owner document of the node as document object. Click 'Press' to see the node name of this <p1> element.</p> <p1 id="PP"></p1> <p1 id="p2"></p1> <p1 id="pl"></p1> <script> function node() { var x = document.getElementById( "PP").ownerDocument.nodeName; document.getElementById("p2").innerHTML = "Node name of the owner document "+ "of this <p1> element is"; document.getElementById("pl").innerHTML = x } </script> </body> </html> Output: Before clicking on the button: After clicking on the button: nodeType property: It returns the node type, as a number, of the specified node. Eg: 1 is returned for an element node and 2 is returned for attribute node. syntax: node.ownerDocument.nodeType; Return Value: The owner document of the node, is returned as the document object. Example-2: Showing nodeType property html <!DOCTYPE html> <html> <body> <h1><center>Geeks <button onclick="node()"> Press </button> </center> </h1> <h4>DOM ownerDocument Property</h4> <p>It returns the owner document of the node as document object. Click 'Press' to see the node type of this <p1> element. </p> <p1 id="PP"></p1> <p1 id="p2"></p1> <p1 id="pl"></p1> <script> function node() { var x = document.getElementById( "PP").ownerDocument.nodeType; document.getElementById("p2").innerHTML = "Node name of the owner document "+ "of this <p1> element is"; document.getElementById("pl").innerHTML = x } </script> </body> </html> Output: Before clicking on the button: After clicking on the button: Browser Support: The browsers supported by DOM ownerDocument property are listed below: Google Chrome 1 and above Edge 12 and above Internet Explorer 6 and above Firefox 9 and above Opera 12.1 and above Safari 1 and above Create Quiz Comment R riarawal99 Follow 1 Improve R riarawal99 Follow 1 Improve Article Tags : Web Technologies HTML HTML-DOM HTML-Property 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 Tables10 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