Name
Text
Description
A Text object represents a run of plain text without markup in a DOM document tree. Do not confuse it with the single-line text input element of HTML, which is represented by the Input object.
Properties
dataThe string of text contained by this node.
lengthThe number of characters contained by this node. Read-only.
Methods
appendData(text)Appends the specified
textto this node and returns nothing.deleteData(offset,count)Deletes text from this node, starting with the character at the specified
offset, and continuing forcountcharacters. Returns nothing.insertData(offset,text)Inserts the specified
textinto this node at the specified characteroffset. Returns nothing.replaceData(offset,count,text)Replaces the characters starting at the specified
offsetand continuing forcountcharacters with the specifiedtext. Returns nothing.splitText(offset)Splits this Text node into two at the specified character position, inserts the new Text node into the document after the original, and returns the new node.
substringData(offset,count)Returns a string that consists of the
countcharacters starting with the character at positionoffset.
See Also
Node.normalize( )
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access