A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/CharacterData/data below:

data · WebPlatform Docs

data Summary

Sets or gets a node’s character data.

Property of dom/CharacterDatadom/CharacterData

Syntax
var 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
DOM Level 1
Recommendation
Attributions

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