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.

wholeText

Summary

Retrieves the immediate text child nodes of the parent node, that are adjacent to the text node.

Property of dom/Textdom/Text

Syntax

Note: This property is read-only.

var text = textNode.wholeText;

Return Value

Returns an object of type StringString

The text of the node and its adjacent text nodes.

Examples

<body>
<p id="p">this is a text node that also has <strong id="s">strong</strong> elements.</p>
<script type="text/javascript">
alert(document.getElementById('p').firstChild.wholeText);
// displays 'this is a text node that also has' in an alert box.
</script>
</body>

Related specifications

DOM Level 3 Core
Recommendation

Attributions