files/en-us/web/api/text/index.md
{{ApiRef("DOM")}}
The Text interface represents a text {{domxref("Node", "node")}} in a DOM tree.
{{InheritanceDiagram}}
To understand what a text node is, consider the following document:
<html lang="en" class="e">
<head>
<title>Aliens?</title>
</head>
<body>
Why yes.
</body>
</html>
In that document, there are five text nodes, with the following contents:
"\n " (after the <head> start tag, a newline followed by four spaces)"Aliens?" (the contents of the title element)"\n " (after the </head> end tag, a newline followed by two spaces)"\n " (after the <body> start tag, a newline followed by two spaces)"\n Why yes.\n \n\n" (the contents of the body element)Each of those text nodes is an object that has the properties and methods documented in this article.
Text node with the parameter as its textual content.Inherits properties from its parents, {{domxref("CharacterData")}}, {{domxref("Node")}}, and {{domxref("EventTarget")}}.
Text nodes logically adjacent to this {{domxref("Node")}}, concatenated in document order.Inherits methods from its parent, {{domxref("CharacterData")}}, {{domxref("Node")}}, and {{domxref("EventTarget")}}.
{{Specifications}}
{{Compat}}