Home  >  Article  >  Web Front-end  >  JS nodeType return type

JS nodeType return type

高洛峰
高洛峰Original
2016-10-13 14:35:081088browse

Record several commonly used attributes in HTML DOM:

nodeName, nodeValue and nodeType contain information about nodes.
nodeName attribute contains the name of a node.

The nodeName of the element node is the tag name
The nodeName of the attribute node is the attribute name
The nodeName of the text node is always #text
The nodeName of the document node is always #document
Note: The tag name of the XML element contained in nodeName is always uppercase The

nodeValue
For text nodes, the nodeValue property contains the text.

For attribute nodes, the nodeValue attribute contains the attribute value.

nodeValue property is not available for document nodes and element nodes. The

nodeType
nodeType property returns the type of node.

The most important node types are:

Element type==》Node type
Element ==》1
Attribute attr ==》2
Text ==》3
Comments ==》8
Document document = =》9


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn