The nodeName attribute contains the name of a node.
The nodeName of the element node is the label name
The nodeName of the attribute node is the attribute name
The nodeName of a text node is always #text
The nodeName of a document node is always #document
nodeValue node value
For text nodes, the nodeValue attribute contains the text.
For attribute nodes, the nodeValue attribute contains the attribute value.
The nodeValue attribute is not available for document nodes and element nodes.
The nodeType attribute returns the type of node.
The most important node types are:
Element element1 attribute attr2 text text3 comments comments8 document document9 Supplement:
Value-element type
1-ELEMENT
2-ATTRIBUTE
3-TEXT
4-CDATA
5-ENTITY REFERENCE
6-ENTITY
7-PI (processing instruction)
8-COMMENT
9-DOCUMENT
10-DOCUMENT TYPE
11-DOCUMENT FRAGMENT
12-NOTATION
typeof
Returns a string representing the expression data type. Possible strings are: "number", "string", "boolean", "object", "function" and "undefined"
The above is the entire content of this article. Do you have any new understanding of these 4 knowledge points? If you have any questions, please leave me a message.