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.

substringData

Summary

Extracts a range of characters from the node.

Method of dom/CharacterDatadom/CharacterData

Syntax

var substring = textualNode.substringData(offset, count);

Parameters

offset

Data-type
String

The zero-based offset from which to start.

count

Data-type
String

The number of characters to extract.

Return Value

Returns an object of type StringString

The requested substring.

Examples

//create text node
var phrase = document.createTextNode ("A flawed plan today is way better than a perfect plan tomorrow.");
//retrieve substring "way"
var subst = phrase.substringData(23, 3);
//report result
alert(subst);

Notes

If the sum of the offset and count parameters exceeds the number of characters in the object, then an error is returned.

Syntax

Standards information

Related specifications

DOM Level 3 Core
Recommendation

Attributions