List of All HTML DOM Document Object Properties and Methods

The DOM or Document Object Model is the API that becomes available when an HTML page loads in a browser. This object model contains more than 50 methods and properties which can be accessed using the document keyword in JavaScript.

 

One example of utilising the DOM API is to get the title of an HTML document using the document.title property:

 

<!DOCTYPE html>
<html>
<head>
  <title>Test</title>
</head>
<body>
</body>
</html>
console.log(document.title);
Test

 

The DOM has powerful functionalities that will allow you to access how the user is interacting with the page among many other things.

 

Here is a full list of all the current Document Model Objects:

 

Method / PropertyDescription
activeElementGets the element that is currently focused on.
addEventListener()Sets an event listener.
adoptNode()Adopt node from another document.
anchorsGet all the anchor (a) elements in the document.
appletsGet all the applet (applet) elements in the document. 
baseURIGet the document base URI 
bodyGet the body element and all the elements inside it. 
close()Close the stream opened by document.open().
cookieGet cookies set in the document. 
characterSetGet the document character encoding.
createAttribute()Create an attribute with a specific name. 
createComment()Create an HTML comment. 
createDocumentFragment()Create a document fragment node.
createElement()Create an element node. 
createEvent()Create an event.
createTextNode()Create a text node. 
defaultViewGet the document window object, null is returned if there is none. 
designModeMake the document editable or not.
doctypeGet the full doctype declaration. 
documentElementGet the html element and all the elements inside it. 
documentModeMake the document editable.
documentURIGet the URI of the document. 
domainGet the DNS of the document. 
embedsGet all the embed elements in the document.
execCommand()Run a clipboard operation on the element in focus. 
formsGet all the form elements in the document. 
fullscreenElementGet the current element displayed in fullscreen mode.
fullscreenEnabled()Get boolean of whether the document can be viewed in fullscreen mode.
getElementById()Get an element by its ID.
getElementsByClassName()Get all elements with a class. 
getElementsByName()Get all elements with a specific name attribute. 
getElementsByTagName()Get all elements with a specified tag name. 
hasFocus()Returns boolean true or false if the document has focus.
headGet the head element and its contents. 
imagesGet all the img elements in the document. 
implementationGet the DOMImplementation object for the document.
importNode()Import a node from another document.
inputEncodingGet the character encoding for the document. 
lastModifiedGet the last modified date of the document. 
linksGet all the anchor (a) and area elements that have href attributes. 
normalize()Remove empty text and join adjacent nodes.
normalizeDocument()Same behaviour as normalize()
open()Open a stream to gather information from the document.write() method.
querySelector()Get the first element that matches a CSS selector. 
querySelectorAll()Get a list of all the nodes that match a CSS selector.
readyStateGet the loading status of the document. 
referrerGet the document that loaded this document. 
removeEventListener()Remove an event handler than was added with addEventListener(). 
renameNode()Rename a node.
scripts Get all the script elements.
strictErrorCheckingSet error checking to strict.
titleGet the contents of the HTML title element. 
URLGet the full URL of the document. 
write()Write HTML or JavaScript to the document.
writeln()Same as write() except it adds a newline after every statement. 

Conclusion

This list of all HTML DOM properties and methods should give you a good idea of what information can be done with Document Objects.

document list