The best HTML DOM property Tutorial In 2024, In this tutorial you can learn Programming Interface,innerHTML property,Examples,Examples,nodeValue property,Gets the value of the element,Examples,nodeType property,
Property is the value of node (HTML elements), you can get or set.
By JavaScript (and other programming languages) to HTML DOM access.
All HTML elements are defined as an object, and the programming interface is object method and object properties.
The method is an operation (such as adding or modify elements) that you can perform.
Property is that you can get or set value (for example, node name or content).
The easiest way to get the content of the element is to use the innerHTML property.
innerHTML property to get or replace the content of HTML elements useful.
The following code gets the id = "intro" the <p> element innerHTML:
In the example above, getElementById is a method, while innerHTML is a property.
innerHTML property can be used to obtain or alter any HTML elements, including <html> and <body>. |
NodeName attribute specifies the name of the node.
Note: nodeName always contain uppercase HTML element tag name.
NodeValue property value specified node.
The following example will retrieve <p id = "intro"> tag text node values:
nodeType property returns the type of node. nodeType is read-only.
Node types are more important:
Element Type | NodeType |
---|---|
element | 1 |
Attributes | 2 |
text | 3 |
Note | 8 |
File | 9 |