Easy Tutorial
❮ Dom Node Prop Documenttype Internalsubset ❯

XML DOM replaceData() Method



Definition and Usage

The replaceData() method replaces data in a text node.

Syntax

Parameter Description
start Required. Specifies where to start replacing characters. The start value begins at 0.
length Required. Specifies how many characters to replace.
string Required. Specifies the string to insert.

In all examples, we use the XML file books.xml and the JavaScript function loadXMLDoc().

Example

The following code snippet replaces the first 8 characters of the text node in the first <title> element with "Easy":

Example

Output:


❮ Dom Node Prop Documenttype Internalsubset ❯