wholeText
Summary
Retrieves the immediate text child nodes of the parent node, that are adjacent to the text node.
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
Mozilla Developer Network : [Text.wholeText Article]
Microsoft Developer Network: [wholeText Property Article]