innerHTML Property
innerHTML property.
innerHTML is not a part of the W3C DOM specification.
However, it is supported by all major browsers.
The innerHTML property is useful for returning or replacing the content of HTML elements.
The innerHTML property can also be used to view the source of a page that has been dynamically modified.
The code on the right gets the innerHTML (text) from the <p> element with id="intro" |
|
childNodes and nodeValue Properties
childNodes and nodeValue can also be used to get the content of an element.
In the example below, getElementById is a method, while childNodes and nodeValue are properties.
The code on the right gets the value of the <p> element with id="intro" |
|