all
alt
ch
dir
id
min
rel
top
url
URL
urn
Expand Minimize

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:
© 2014 Microsoft. All rights reserved.