element with id="intro": ## Example
Hello World!
var txt=document.getElementById("intro").innerHTML; document.write(txt); [Try it Yourself Β»](#) In the example above, getElementById is a method, while innerHTML is a property. |  | The innerHTML property can be used to get or change any HTML element, including and . | | --- | * * * The nodeName property specifies the name of a node. * nodeName is read-only * The nodeName of element nodes is the same as the tag name * The nodeName of attribute nodes is the same as the attribute name * The nodeName of text nodes is always #text * The nodeName of the document node is always #document **Note:** nodeName always contains the uppercase tag name of the HTML element. * * * ## The nodeValue Property The nodeValue property specifies the value of a node. * The nodeValue for element nodes is undefined or null * The nodeValue for text nodes is the text itself * The nodeValue for attribute nodes is the attribute value * * * ## Getting Element Values The following example retrieves the text node value of thetag: ## Example
Hello World!
x=document.getElementById("intro"); document.write(x.firstChild.nodeValue); [Try it Yourself Β»](#) * * * ## The nodeType Property The nodeType property returns the type of a node. nodeType is read-only. The most important node types are: | Element Type | NodeType | | --- | --- | | Element | 1 | | Attribute | 2 | | Text | 3 | | Comment | 8 | | Document | 9 |
YouTip