JavaScript
HTML
CSS
jQuery
PHP
SQL
WordPress
- Tags: JS DOM, JS DOM Element
- Categories: JavaScript Properties, JavaScript Reference, Reference
Last Updated on November 15, 2022
Quick Reference
The Element ownerDocument property returns the owner document of a node, as a Document object.
Note
A node can be an HTML element (div, span, p, h2, etc.), or it can be a text node (plain text, white space, a teb, a linebreak). Whereas, when referring just to an element, only the HTML elements are relevant.
// variable
let x = document.getElementById('my_output');
// output to the console
console.log(x.ownerDocument);
Output
(will output the entire HTML document to the console)
...