HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
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 |