This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

insertData

Summary

Inserts a new character string into the node at the specified offset.

Method of dom/CharacterDatadom/CharacterData

Syntax

 textualNode.insertData(offset, text);

Parameters

offset

Data-type
String

The zero-based offset from which to start.

text

Data-type
String

The new character string.

Return Value

No return value

Examples

//create text node
var phrase = document.createTextNode ("A flawed plan today is better than a perfect plan tomorrow.");
//insert "much " (note trailing space)
phrase.insertData(23, "much ");
//report result
alert(phrase.data);

Related specifications

DOM Level 3 Core
Recommendation

Attributions