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.

toString

Summary

Returns the contents of a Range as a string. This string contains only the data characters, no markup.

Method of dom/Rangedom/Range

Syntax

var text = range.toString();

Return Value

Returns an object of type StringString

Contains only the data characters, no markup.

Examples

var range = document.createRange();

range.selectNode(document.getElementsByTagName("div").item(0));
text = range.toString();

Syntax

text = range.toString();

Standards information

Related specifications

DOM
Living Standard

Attributions