Sets or gets a node’s character data.
Property of dom/CharacterDatadom/CharacterData
Syntaxvar text = textualNode.html/elements/data;
textualNode.html/elements/data = newText;
Return Value
Returns an object of type StringString
The value of the text node.
Examples
var phrase = document.createTextNode ("A flawed plan today is better than a perfect plan tomorrow.");
alert(phrase.data);
phrase.data = "Any plan is better than no plan at all.";
alert(phrase.data);
This example uses the data property to change the value of a text node.
<script>
function fnChangeValue(){
var oNode = oList.firstChild.childNodes(0);
var oNewText = document.createTextNode();
oNewText.data="Create Data";
oNode.replaceNode(oNewText);
oNode.data = "New Node Value";
}
</script>
<ul id="oList" onclick="fnChangeValue()">
<li>Start Here</li>
</ul>
Related specifications
Microsoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4