data property
Sets or gets the value of a TextNode object.
Syntax
| JavaScript | |
|---|
Property values
Type: String
the value of the TextNode.
Standards information
- Document Object Model (DOM) Level 1 Specification, Section 1.2
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
Send comments about this topic to Microsoft
Build date: 11/28/2012