data (TextNode)
all
alt
ch
dir
id
min
rel
top
url
URL
urn
TOC
Collapse the table of content
Expand the table of content

data property

Sets or gets the value of a TextNode object.

Syntax

JavaScript

p = object.data

 

Property values

Type: String

the value of the TextNode.

Standards information

Examples

This example uses the data property to change the value of a text node.


<script type="text/javascript">
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>

See also

TextNode

 

 

Show:
© 2017 Microsoft